Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion content/en/fortran.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ initialisation.

Fortran cells run in the browser playground, with no server and no compiler:
the evaluator is linked into the playground's second WebAssembly core (the
one it loads for a notebook with a Fortran, R, Ruby or Julia cell), through
one it loads for a notebook with a Fortran, R or Ruby cell; a Julia cell loads a
third core that has it too), through
`fcells.Session.Eval`; the default core stays Go-only. The playground bounds a
cell tighter than the kernel does: 200 million DO iterations and procedure
calls, 10 s and 16 MiB of output per stream. An endless `do` ends with
Expand Down
40 changes: 31 additions & 9 deletions content/en/julia.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,34 @@ go-rouge's `julia` lexer.

## In the browser

The [playground](https://go-notebook.github.io/playground/) does not run Julia
cells: its WebAssembly core parses and checks them, the cell's badge reads
**Julia — not runnable yet**, and the cell says *Julia cells run in
go-notebook, not yet in the browser*. The page treats Julia as check-only by
language, so a Julia cell never reaches its Go evaluator. Running them there is
a separate question, pending with go-embedded-julia.

Try the [Julia example notebook](https://go-notebook.github.io/playground/#4-julia)
there for the checks; `notebook run` and `notebook serve` run the cells.
Since playground v0.18.0 the [playground](https://go-notebook.github.io/playground/)
runs Julia cells, on go-embedded-julia v0.17.0 compiled to WebAssembly, with no
external `julia`. It is the heaviest runtime the page has, so it is **loaded on
first use**: a Julia cell's badge reads *Julia · loads when run (~28 MB)*, and
Run downloads a third core (20 MB gzipped, the second core plus the interpreter)
and the Base image (7.8 MB gzipped, checked against its pinned SHA-256 before it
is decoded), then boots the kernel: about **28 MB and about 20 s** the first
time, shown on the cell as it loads, then cached by the browser. Opening a
notebook, and running the cells above its first Julia cell, download nothing for
Julia; the default, Ruby, R and Fortran cores never carry it. If the load fails
(network, memory) the Julia cells say so and the other languages run.

- **Limits**: **512 MiB** of arrays, **20 million statements**, **20 s** (R's is
10 s: a Julia cell compiles what it uses the first time) and 16 MiB of output.
A cell that goes past one is stopped with a message that says which, and the
worker is not killed. Deep recursion is a Julia `StackOverflowError`, not a
lost core.
- **Julia is isolated from Go in the page.** The variables that cross in
`notebook run` (above) do not cross in the page, in either direction: a cell
that reads one fails with the other language's own message and a note saying
why. Julia variables persist from one Julia cell to the next.
- **Each run is a fresh kernel in a fresh worker.** go-embedded-julia cannot yet
reset a kernel, and a second kernel in a process that has run Julia can fail
([go-embedded-julia#92](https://github.com/go-embedded-julia/julia/issues/92)),
so after a run that executed a Julia cell the page replaces the Julia worker
(about 8 s of boot, from the browser cache, while the page is idle). A `struct`
a notebook defines is not a redefinition the second time it runs. A
`Kernel.Reset` ([#93](https://github.com/go-embedded-julia/julia/issues/93))
would remove the restarts.

Try the [Julia example notebook](https://go-notebook.github.io/playground/#4-julia).
30 changes: 24 additions & 6 deletions content/en/playground.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ tags: [playground]
The [playground](https://go-notebook.github.io/playground/) runs a notebook
in the browser, with no server. Go cells run in an interpreter compiled to
WebAssembly; Ruby cells run in [rbgo](https://github.com/go-embedded-ruby/ruby), R cells in
[go-embedded-r](https://github.com/go-embedded-r/r) and Fortran cells in
[go-embedded-fortran](https://github.com/go-embedded-fortran/fortran).
[go-embedded-r](https://github.com/go-embedded-r/r), Fortran cells in
[go-embedded-fortran](https://github.com/go-embedded-fortran/fortran) and Julia
cells in [go-embedded-julia](https://github.com/go-embedded-julia/julia).
These are its controls from go-notebook/playground v0.6.0. The keys are
Jupyter's, with the same meanings; every key has a button too, because a
phone has no keyboard.
Expand Down Expand Up @@ -83,10 +84,10 @@ On a narrow screen a cell's buttons fold behind **⋯**.
## Choosing and changing a language

**+ Add cell** asks what the new cell is: Go, Fortran, R, Ruby, C, Julia or Markdown,
the languages go-notebook registers. A C or Julia cell is parsed and
checked, not run yet, and the menu says so (*C · not runnable yet*,
*Julia · not runnable yet*); a cell that reads it is
shown as blocked. C cells are checked in order, so a cell sees the typedefs
the languages go-notebook registers. A C cell is parsed and
checked, not run yet, and the menu says so (*C · not runnable yet*); a cell
that reads it is shown as blocked. A Julia cell **runs**, in a third core
loaded the first time one is run, see [Julia cells](#julia-cells). C cells are checked in order, so a cell sees the typedefs
and macros of the C cells above it (playground v0.12.0). An R cell **runs**
(playground v0.14.0), see [R cells](#r-cells). The language
of the code cell above comes first, marked *(as above)*. A cell's language
Expand Down Expand Up @@ -127,6 +128,23 @@ and 16 MiB of output per stream; an endless `do` ends with a message that says
so and the page stays usable. The second core is about 1.3 MB larger. See
[Fortran cells](fortran.md).

## Julia cells

Since playground v0.18.0 a Julia cell runs in the page, in a **third core**
(the second core plus go-embedded-julia's interpreter) that the page loads only
when a Julia cell is run: about **28 MB** (20 MB for the core and 7.8 MB for the
Base image, gzipped) and about **20 s** the first time, with the progress shown
on the cell. A page that opens a Julia notebook, or runs the cells above its
first Julia cell, downloads nothing for Julia. A cell is bounded: **512 MiB** of
arrays, **20 million statements**, **20 s** and 16 MiB of output. Julia's
variables are **isolated from Go's** in the page: they persist from one Julia
cell to the next and do not cross to the other languages (they do in
`notebook run`). Each run that executed a Julia cell is followed by a
replacement of the Julia worker, so the next run has a fresh kernel
([go-embedded-julia#92](https://github.com/go-embedded-julia/julia/issues/92),
[#93](https://github.com/go-embedded-julia/julia/issues/93)). See
[Julia cells](julia.md#in-the-browser).

## Limits

A notebook you open may come from anyone. The playground gives it:
Expand Down
Loading