A DOM-free UI — events in, pixels out
The entire UI (sidebar, button, fractal) is rendered in Rust
(wasm32-unknown-unknown, #![no_std]). JS owns
only the <canvas>: it pumps mouse state into
render(mx, my, down, cx, cy) as scalar args and paints the
returned zero-copy Uint8Array with putImageData.
Click PAUSE, then move the mouse over the fractal to
drive the Julia constant. UI state lives in wasm memory.
Parallel Mandelbrot — wasm_zero + rayon, sandboxed via exu
Computed in WebAssembly with rayon. Single thread runs
on one worker; Multi thread spreads the rows across
navigator.hardwareConcurrency workers sharing one linear
memory. The RGBA result is read zero-copy from shared memory and blitted
to the canvas. Workers are pooled/reused; the wasm memory is dropped per run.
wasm_bindgen vs wasm_zero
Each row runs a test N times in three suites: a pure-JS baseline,
wasm_bindgen, and wasm_zero (lazy zero-copy
access — every field is read so the comparison is fair). Times are the
min of several runs; the parenthesised number is the ratio to the JS
baseline (lower is faster).
| Test | js | wasm_bindgen | wasm_zero |
|---|