Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI
perf docs
Preetham Pemmasani9008b4a3ee8e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1cc0eed..ca2191a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -28,7 +28,30 @@ All notable changes to **blenderui** (BUI). The format followsglobals DOM frameworks read), and `bui build` bundling with the Bun plugin of every`@blender-ui/*` package that declares one (`"bui": { "bunPlugin" }`). A binding for anotherframework is a thin adapter over these.-- **Benchmarks:** `bench/cells.js --svelte [--signals]` and `bench/startup.js --svelte`.+- **Benchmarks:** `bench/cells.js --svelte [--signals]` and `bench/startup.js --svelte`;+ `cells.js` also reports `js_us_per_update` (500 updates back to back, each applied by the+ framework and sent to the UI thread: the JavaScript cost of an update alone) and `heap_mb`.+- **Svelte, faster updates:** compiled components import `@blender-ui/svelte/internal`, which+ serves Svelte's runtime with `set_text`, `set_attribute`, `set_class`, `set_style` and `clsx`+ writing straight into BUI's nodes (each used only while Svelte's own has the shape it was+ written for; a test compares them on the same inputs). A BUI signal passed as a value+ (`{label}`, `style={style}`, `class={cls}`) binds its node: a write updates it without Svelte+ running, as React's signal props do.+- **Svelte, faster start on Node.js and Bun:** with Bun installed, `register` bundles Svelte's+ client runtime once (per Svelte version) into `node_modules/.cache/@blender-ui/svelte` and+ serves it from there; the compile cache is found from the working directory up, and cache+ keys no longer load `node:crypto`.+- **`@blender-ui/native`, slimmer nodes:** attributes are a flat array made by the first one+ (not a `Map` per element), `tagName` is derived from `localName`, and children, signal+ bindings, listeners and form state live on the prototype until a node has them; a text node+ is five fields. About 0.7 MB less JavaScript heap for a 3,000-cell grid, in React and Svelte+ alike.+- **Measured** (3,000 cells, one session, Node 26 / Bun 1.4 / QuickJS): an update costs 17 / 19 /+ 36 µs of JavaScript in Svelte with signals (was 87 / 86 / 793; React with signals 23 / 17 / 40),+ 65 / 76 / 790 µs with runes (was 85 / 78 / 790); a Svelte app's first frame is 135 ms on Node.js+ and 121 ms on Bun (was 393 / 203; React 125 / 107). Svelte still keeps 10–17 MB more than React+ with signals at 3,000 cells: its own effects and each-block items. Details in+ docs/javascript.md.### Changed- **`@blender-ui/native`:** siblings are a linked list (insert, remove and `nextSibling` arediff --git a/README.md b/README.mdindex 1fa1e3f..1cb1c87 100644--- a/README.md+++ b/README.md@@ -1503,34 +1503,42 @@ What this means:**React and Svelte, side by side** (one session, runs interleaved, medians of3; `--svelte` in the commands below):-| 3,000 cells, one session | FPS | CPU per frame | RAM |-| ------------------------------------------- | ----------: | ----------------: | -------------: |-| Node 26: React with state / with signals | 27.6 / 27.6 | 42.5 / 36.9 ms | 150 / 98 MB |-| Node 26: Svelte (runes) / with signals | 24.8 / 26.6 | 41.5 / 38.6 ms | 119 / 118 MB |-| Bun 1.4: React with state / with signals | 24.0 / 25.0 | 55.8 / 40.8 ms | 111 / 86 MB |-| Bun 1.4: Svelte (runes) / with signals | 26.4 / 27.0 | 39.3 / 38.2 ms | 100 / 100 MB |-| QuickJS: React with state / with signals | 8.5 / 27.0 | 117 / 37.3 ms | 67 / 62 MB |-| QuickJS: Svelte (runes) / with signals | 26.9 / 25.9 | 37.5 / 38.7 ms | 76 / 76 MB |--| First frame, median of 12 (React / Svelte) | First frame | RAM at first frame |-| ------------------------------------------- | ------------: | -----------------: |-| QuickJS executable (`bui build`, 6.9 MB) | 94 / 89 ms | 20.5 / 19.8 MB |-| Bun executable (`bui build --bun`) | 111 / 107 ms | 37.8 / 38.3 MB |-| Bun (`--preload …/register` for Svelte) | 130 / 243 ms | 36.4 / 46.6 MB |-| Node.js (`--import …/register` for Svelte) | 147 / 440 ms | 46.8 / 64.1 MB |--- **Svelte needs no signals to stay cheap:** runes update the one cell that- changes, so Svelte costs what React with signals does on every runtime, and- holds 27 FPS on QuickJS where React re-rendering the grid falls to 8.5.-- **Memory:** Svelte keeps 14–21 MB more than React with signals at 3,000- cells (its effects and each-block items).-- **Startup:** built with `bui build`, both reach the first frame in about- 90 ms. On Node.js and Bun, Svelte's runtime loads from about 90 source files- first (components come from the compile cache).-- **This session ran at about 27 FPS** for every variant (the machine, not the- code), so compare these rows with each other, not with the tables above.- React with state cost 45.8 ms and 190 MB on Node in the same session before- this release's DOM changes (linked siblings, lazy listener maps).+| 3,000 cells, one session (Node 26 / Bun 1.4 / QuickJS) | CPU per frame | RAM | JavaScript per update |+| ----------------------------------------------------- | --------------------: | ---------------: | ----------------------: |+| Plain JS | 37.0 / 37.4 / 38.6 ms | 92 / 81 / 59 MB | 14 / 13 / 28 µs |+| React with signals | 37.6 / 38.4 / 37.8 ms | 100 / 87 / 60 MB | 23 / 17 / 40 µs |+| Svelte with signals (as values) | 39.0 / 36.8 / 38.5 ms | 116 / 97 / 75 MB | 17 / 19 / 36 µs |+| Svelte with runes | 39.4 / 35.9 / 37.0 ms | 117 / 98 / 75 MB | 65 / 76 / 790 µs |+| React with state | 38.1 ms on Node | 166 MB on Node | 5.2 / 8.6 / 76 ms |++| First frame, median of 12 | React | Svelte | Svelte before | RAM (React / Svelte) |+| -------------------------------- | -----: | -----: | ------------: | -------------------: |+| QuickJS executable (`bui build`) | 93 ms | 89 ms | 81 ms | 20.4 / 20.4 MB |+| Bun executable (`--bun`) | 106 ms | 90 ms | 94 ms | 37.8 / 38.8 MB |+| Bun (`--preload …/register`) | 107 ms | 121 ms | 203 ms | 36.5 / 40.2 MB |+| Node.js (`--import …/register`) | 125 ms | 135 ms | 393 ms | 52.1 / 55.4 MB |++- **Every variant ran at 26–29 FPS** in this session (the machine, not the+ code), so CPU per frame is mostly BUI's own rendering and differs within+ noise. "JavaScript per update" is the cost of one update alone: 500 back to+ back, each applied by the framework and sent to the UI thread.+- **Svelte with signals costs what React with signals does:** a BUI signal+ passed as a value (`{label}`, `style={style}`) binds its node, so an+ update skips Svelte. Before this release's work it went through Svelte as a+ store: 86–87 µs on Node.js and Bun, 793 µs on QuickJS.+- **Svelte with runes** pays Svelte's flush, which walks the component's+ effects (3,000 here): 65–76 µs, 790 µs on QuickJS (85 / 78 / 790 before).+- **Memory:** Svelte keeps 10–17 MB more than React with signals (6 MB less+ than before on Node). A heap snapshot puts the rest in Svelte's own effects,+ closures and each-block items, about 1.9 KB per cell; BUI's nodes are the+ same for both.+- **Startup:** `register` serves Svelte's runtime bundled (once, with Bun,+ into `node_modules/.cache`), which brought Node.js from 393 to 135 ms and+ Bun from 203 to 121 ms. React and Svelte ran one after the other here.+- **React with state** on Bun and QuickJS: the 500 back-to-back re-renders+ overran the warm-up, so only its per-update cost is valid from this session.+ Bun also sometimes crashes when a React app quits (after its first frame), a+ bug that predates this work.Method, the memory breakdown and how to rerun:[docs/javascript.md](docs/javascript.md#performance).diff --git a/bindings/svelte/README.md b/bindings/svelte/README.mdindex f06b2ce..a7307d7 100644--- a/bindings/svelte/README.md+++ b/bindings/svelte/README.md@@ -45,9 +45,11 @@ bun --preload @blender-ui/svelte/register app.js # Bunnpx bui build app.js # ship it: one small executable```-`register` compiles `.svelte` (and `.svelte.js`) files on import, caching the-output in `node_modules/.cache/@blender-ui/svelte`, and resolves `svelte` to-its browser build. `bui build` finds this package's bundler plugin by itself.+`register` compiles `.svelte` (and `.svelte.js`) files on import and resolves+`svelte` to its browser build. It caches both in+`node_modules/.cache/@blender-ui/svelte`: the compiled components, and (when+Bun is installed) Svelte's runtime bundled on the first run, so it loads like+one module. `bui build` finds this package's bundler plugin by itself.## API@@ -57,7 +59,7 @@ its browser build. `bui build` finds this package's bundler plugin by itself.| `createRoot(window)` | `{ render(Component, { props, context }), unmount() }` for a window you opened with [`@blender-ui/native`](https://www.npmjs.com/package/@blender-ui/native); closing the window unmounts it || `act(fn)` | Runs `fn` and applies Svelte's pending updates now (tests) || `Button`, `Checkbox`, `Radio`, `NumberField`, `NumberSlider`, `TextField`, `TextArea`, `ColorSwatch`, `Dropdown`, `ProgressBar` | Blender's widgets, always drawn and handled like Blender |-| `signal`, `computed`, `effect`, `batch`, `untrack`, `createSignal`, `ref`, `startTransition` | BUI's signals, for state outside components; each is a Svelte store (`$count`) |+| `signal`, `computed`, `effect`, `batch`, `untrack`, `createSignal`, `ref`, `startTransition` | BUI's signals, for state outside components. As a value (`{label}`, `style={style}`) a signal binds its node, so a write updates it without Svelte running; as a store (`$count`) the component follows it |Options: `props`, `context`, and the window's `title`, `width`, `height`,`resizable`, `gpu`, `slug`, `headless`, `theme` (`'dark'` or `'light'`) and@@ -72,7 +74,11 @@ retained tree when inserted, comments are anchors that take no space, and onlythe changes of each tick cross to BUI's UI thread. Components compile with`fragments: 'tree'` (templates built with `createElement`, no HTML parser).Svelte's event delegation works: an element with an `onclick` listens-natively, so BUI sends it its clicks.+natively, so BUI sends it its clicks. The functions Svelte's templates call on+each update (`set_text`, `set_attribute`, `set_class`, `set_style`, `clsx`)+are served by `internal.js` and write straight into BUI's nodes; each is+used only while Svelte's has the shape it was written for (a test compares+them), otherwise Svelte's own runs.Not there yet: transitions run their start and end without animating inbetween; `{@html}` (no HTML parser); `bind:clientWidth` and other sizediff --git a/bindings/svelte/package.json b/bindings/svelte/package.jsonindex fb2b396..b038363 100644--- a/bindings/svelte/package.json+++ b/bindings/svelte/package.json@@ -29,6 +29,7 @@"compile.js","plugin.js","register.js",+ "runtime.js","README.md","LICENSE"],diff --git a/docs/javascript.md b/docs/javascript.mdindex deeda8e..0625aee 100644--- a/docs/javascript.md+++ b/docs/javascript.md@@ -482,37 +482,45 @@ Where the memory goes, for plain JS on Node at 3,000 cells:The same scenes from `@blender-ui/react` and `@blender-ui/svelte`(`bench/cells.js 3000 --gpu --react|--svelte [--signals]`, `bench/startup.js[--svelte]`), on the Ryzen 7 5800U laptop, Windows 11, Node.js 26.13, Bun-1.4.4, in one session (2026-11-06): cells runs interleaved, medians of 3.-"Svelte with signals" passes BUI signals as stores (`{$label}`).--| 3,000 cells, one session | FPS | CPU per frame | RAM |-| ------------------------------------------- | ----------: | ----------------: | -------------: |-| Node 26: React with state / with signals | 27.6 / 27.6 | 42.5 / 36.9 ms | 150 / 98 MB |-| Node 26: Svelte (runes) / with signals | 24.8 / 26.6 | 41.5 / 38.6 ms | 119 / 118 MB |-| Bun 1.4: React with state / with signals | 24.0 / 25.0 | 55.8 / 40.8 ms | 111 / 86 MB |-| Bun 1.4: Svelte (runes) / with signals | 26.4 / 27.0 | 39.3 / 38.2 ms | 100 / 100 MB |-| QuickJS: React with state / with signals | 8.5 / 27.0 | 117 / 37.3 ms | 67 / 62 MB |-| QuickJS: Svelte (runes) / with signals | 26.9 / 25.9 | 37.5 / 38.7 ms | 76 / 76 MB |--| First frame, median of 12 (React / Svelte) | First frame | RAM at first frame |-| ------------------------------------------- | ------------: | -----------------: |-| QuickJS executable (`bui build`, 6.9 MB) | 94 / 89 ms | 20.5 / 19.8 MB |-| Bun executable (`bui build --bun`) | 111 / 107 ms | 37.8 / 38.3 MB |-| Bun (`--preload …/register` for Svelte) | 130 / 243 ms | 36.4 / 46.6 MB |-| Node.js (`--import …/register` for Svelte) | 147 / 440 ms | 46.8 / 64.1 MB |--- **Svelte needs no signals to stay cheap:** runes update the one cell that- changes, so Svelte costs what React with signals does on every runtime, and- holds 27 FPS on QuickJS where React re-rendering the grid falls to 8.5.-- **Memory:** Svelte keeps 14–21 MB more than React with signals at 3,000- cells (its effects and each-block items).-- **Startup:** built with `bui build`, both reach the first frame in about- 90 ms. On Node.js and Bun, Svelte's runtime loads from about 90 source files- first (components come from the compile cache).-- **This session ran at about 27 FPS** for every variant (the machine, not the- code), so compare these rows with each other, not with the tables above.- React with state cost 45.8 ms and 190 MB on Node in the same session before- this release's DOM changes (linked siblings, lazy listener maps).+1.4.4, in one session (2026-11-06): cells runs interleaved, medians of 3, with+the previous Svelte binding (`Svelte before`) in the same session.++| 3,000 cells, one session (Node 26 / Bun 1.4 / QuickJS) | CPU per frame | RAM | JavaScript per update |+| ----------------------------------------------------- | --------------------: | ---------------: | ----------------------: |+| Plain JS | 37.0 / 37.4 / 38.6 ms | 92 / 81 / 59 MB | 14 / 13 / 28 µs |+| React with signals | 37.6 / 38.4 / 37.8 ms | 100 / 87 / 60 MB | 23 / 17 / 40 µs |+| Svelte with signals (as values) | 39.0 / 36.8 / 38.5 ms | 116 / 97 / 75 MB | 17 / 19 / 36 µs |+| Svelte with runes | 39.4 / 35.9 / 37.0 ms | 117 / 98 / 75 MB | 65 / 76 / 790 µs |+| React with state | 38.1 ms on Node | 166 MB on Node | 5.2 / 8.6 / 76 ms |++| First frame, median of 12 | React | Svelte | Svelte before | RAM (React / Svelte) |+| -------------------------------- | -----: | -----: | ------------: | -------------------: |+| QuickJS executable (`bui build`) | 93 ms | 89 ms | 81 ms | 20.4 / 20.4 MB |+| Bun executable (`--bun`) | 106 ms | 90 ms | 94 ms | 37.8 / 38.8 MB |+| Bun (`--preload …/register`) | 107 ms | 121 ms | 203 ms | 36.5 / 40.2 MB |+| Node.js (`--import …/register`) | 125 ms | 135 ms | 393 ms | 52.1 / 55.4 MB |++- **Every variant ran at 26–29 FPS** in this session (the machine, not the+ code), so CPU per frame is mostly BUI's own rendering and differs within+ noise. "JavaScript per update" is the cost of one update alone: 500 back to+ back, each applied by the framework and sent to the UI thread.+- **Svelte with signals costs what React with signals does:** a BUI signal+ passed as a value (`{label}`, `style={style}`) binds its node, so an+ update skips Svelte. Before this release's work it went through Svelte as a+ store: 86–87 µs on Node.js and Bun, 793 µs on QuickJS.+- **Svelte with runes** pays Svelte's flush, which walks the component's+ effects (3,000 here): 65–76 µs, 790 µs on QuickJS (85 / 78 / 790 before).+- **Memory:** Svelte keeps 10–17 MB more than React with signals (6 MB less+ than before on Node). A heap snapshot puts the rest in Svelte's own effects,+ closures and each-block items, about 1.9 KB per cell; BUI's nodes are the+ same for both.+- **Startup:** `register` serves Svelte's runtime bundled (once, with Bun,+ into `node_modules/.cache`), which brought Node.js from 393 to 135 ms and+ Bun from 203 to 121 ms. React and Svelte ran one after the other here.+- **React with state** on Bun and QuickJS: the 500 back-to-back re-renders+ overran the warm-up, so only its per-update cost is valid from this session.+ Bun also sometimes crashes when a React app quits (after its first frame), a+ bug that predates this work.## Buildingdiff --git a/website/src/content/docs/javascript/svelte.mdx b/website/src/content/docs/javascript/svelte.mdxindex 8a02fec..039df80 100644--- a/website/src/content/docs/javascript/svelte.mdx+++ b/website/src/content/docs/javascript/svelte.mdx@@ -52,7 +52,7 @@ node --import @blender-ui/svelte/register app.jsbun --preload @blender-ui/svelte/register app.js```-`register` teaches the runtime two things: `.svelte` files (and `.svelte.js` rune modules) import as compiled components, and `svelte` resolves to its browser build. Compiled components are cached in `node_modules/.cache/@blender-ui/svelte`, so later starts skip Svelte's compiler. With Bun you can put the preload in `bunfig.toml` instead: `preload = ["@blender-ui/svelte/register"]`.+`register` teaches the runtime two things: `.svelte` files (and `.svelte.js` rune modules) import as compiled components, and `svelte` resolves to its browser build. Both are cached in `node_modules/.cache/@blender-ui/svelte`: compiled components, so later starts skip Svelte's compiler, and, when Bun is installed, Svelte's runtime bundled into a few modules on the first run, so it loads like one. With Bun you can put the preload in `bunfig.toml` instead: `preload = ["@blender-ui/svelte/register"]`.## `render` and `createRoot`@@ -119,13 +119,17 @@ A component's `<style>` block works: Svelte scopes it to the component, and BUI## Signals-Runes are the way to hold state in Svelte, and they're already fine-grained. For state that lives outside components, `@blender-ui/svelte` exports BUI's signals (`signal`, `computed`, `effect`, `batch`, `untrack`, `createSignal`, `ref`). Each one is a Svelte store, so `$count` follows it inside a component:+Runes are the way to hold state in Svelte, and they're already fine-grained. For state that lives outside components, `@blender-ui/svelte` exports BUI's signals (`signal`, `computed`, `effect`, `batch`, `untrack`, `createSignal`, `ref`). You can use one two ways:++- **As a value** (`{label}`, `style={style}`, `class={cls}`, `title={label}`): the node is bound to the signal. A write updates that node straight away, without Svelte running at all, which is the cheapest update there is.+- **As a store** (`$count`): the component follows it like any other Svelte state, so you can compute with it (`{$selection.length} selected`).```svelte<script>- import { selection } from './store.js' // export const selection = signal([])+ import { selection, status } from './store.js' // signal([]), signal('Ready')</script>+<span>{status}</span><p>{$selection.length} selected</p>```@@ -145,15 +149,19 @@ See [standalone executables](../standalone-executables/) for the options.The same scenes from Svelte and from the React binding, measured in one session:-<BenchChart id="js-frameworks-cpu-3000" />+<BenchChart id="js-frameworks-update" /><BenchTable id="jsFrameworksStartup" />-Svelte's runes update only what changed, so a 3,000-cell grid with one cell changing per frame costs what React with signals does, on Node.js, Bun and QuickJS alike. Built with `bui build`, a Svelte app reaches its first frame as fast as a React one; on Node.js and Bun, Svelte's runtime loads from its source files first. The [benchmarks page](../../performance/benchmarks/) has the method.+- **Signals as values** are the cheapest update: the node is bound to the signal, so a write skips Svelte.+- **Runes** go through Svelte's flush, which visits the component's effects; with thousands of rows that's tens of microseconds per update on Node.js and Bun.+- **Built with `bui build`,** a Svelte app reaches its first frame in under 100 ms. On Node.js and Bun, `register` serves Svelte's runtime bundled, so a start costs little more.++The [benchmarks page](../../performance/benchmarks/) has the method and the full table.## How it works-Svelte has no custom-renderer API: a compiled component calls the DOM directly (`createElement`, `cloneNode`, `insertBefore`, `addEventListener` ...). `@blender-ui/native` provides that DOM. `document` makes detached nodes that join a window's retained tree when they're inserted into it, comments and empty text nodes act as anchors without taking any space, and only the changes of each tick cross to BUI's UI thread. Nodes Svelte drops are freed natively at the end of the tick.+Svelte has no custom-renderer API: a compiled component calls the DOM directly (`createElement`, `cloneNode`, `insertBefore`, `addEventListener` ...). `@blender-ui/native` provides that DOM, and the few functions Svelte's templates call on every update (text, attributes, `class`, `style`) write straight into BUI's nodes. `document` makes detached nodes that join a window's retained tree when they're inserted into it, comments and empty text nodes act as anchors without taking any space, and only the changes of each tick cross to BUI's UI thread. Nodes Svelte drops are freed natively at the end of the tick.Components are compiled with `fragments: 'tree'`, so templates are built with `createElement` rather than an HTML parser.diff --git a/website/src/content/docs/performance/benchmarks.mdx b/website/src/content/docs/performance/benchmarks.mdxindex e872a48..3f9adc5 100644--- a/website/src/content/docs/performance/benchmarks.mdx+++ b/website/src/content/docs/performance/benchmarks.mdx@@ -103,15 +103,18 @@ More results, at 100 and 1,000 cells:### React and Svelte, side by side-**What was measured:** the same scenes from `@blender-ui/react` and `@blender-ui/svelte`, in one session, runs interleaved (`bench/cells.js --react | --svelte [--signals]`, `bench/startup.js [--svelte]`). This session's machine ran every variant at about 27 FPS, so compare these rows with each other, not with the tables above.+**What was measured:** the same scenes from `@blender-ui/react` and `@blender-ui/svelte`, in one session, runs interleaved (`bench/cells.js --react | --svelte [--signals]`, `bench/startup.js [--svelte]`). This session's machine ran every variant at 26–29 FPS, so compare these rows with each other, not with the tables above. Besides CPU per frame (mostly BUI's own rendering here), `cells.js` reports the JavaScript cost of one update alone.-<BenchChart id="js-frameworks-cpu-3000" />+<BenchChart id="js-frameworks-update" />++<BenchTable id="jsFrameworksBefore" /><BenchTable id="jsFrameworksStartup" />-- **Svelte needs no signals to stay cheap:** its runes update the one cell that changes, so it costs what React with signals does, on every runtime. React with state re-renders the grid and falls to 8.5 FPS on QuickJS; Svelte holds 27.-- **Memory:** Svelte keeps more per element than React with signals (its effects and each-block items), 14–21 MB more at 3,000 cells.-- **Startup:** built into an executable, both start in about 90 ms. On Node.js and Bun, Svelte's runtime loads from about 90 source files, which costs 0.1–0.3 s; `bui build` bundles it.+- **Svelte with signals costs what React with signals does:** a BUI signal passed as a value binds its node, so an update skips Svelte entirely (17–36 µs, against 17–40 µs for React).+- **Svelte with runes** pays Svelte's flush, which walks the component's effects: 65–76 µs on Node.js and Bun, 790 µs on QuickJS (no JIT) for 3,000 cells. Per frame, that's within the noise of BUI's rendering.+- **Memory:** Svelte keeps 10–17 MB more than React with signals at 3,000 cells. A heap snapshot puts it in Svelte's own effects, closures and each-block items (about 1.9 KB per cell); BUI's nodes are the same objects for both.+- **Startup:** with its runtime bundled, a Svelte app reaches its first frame within 10–15 ms of a React one on Node.js and Bun (it was 0.1–0.3 s later), and as fast as React's when built with `bui build`.<Callout type="joke">Unlike a Cycles render, these numbers don't get any less noisy if you leave them running overnight. Run each benchmark a few times instead.diff --git a/website/src/data/bench.ts b/website/src/data/bench.tsindex 5d33c94..3ac861e 100644--- a/website/src/data/bench.ts+++ b/website/src/data/bench.ts@@ -195,31 +195,48 @@ const tablesBase = {},jsFrameworksStartup: {caption:- "React vs Svelte, startup: the same small counter app (bench/first-frame.js, bench/first-frame-svelte.js) quits after its first frame; median of 12 launches after a warm-up, one session (2026-11-06)",- columns: ["First frame (React / Svelte)", "React", "Svelte", "RAM at first frame (React / Svelte)"],- numeric: [1, 2, 3],+ "React vs Svelte, startup: the same small counter app (bench/first-frame.js, bench/first-frame-svelte.js) quits after its first frame; median of 12 launches after a warm-up, one session (2026-11-06, after this release's Svelte work)",+ columns: ["First frame", "React", "Svelte", "Svelte before", "RAM at first frame (React / Svelte)"],+ numeric: [1, 2, 3, 4],rows: [- ["<strong>QuickJS executable</strong> (bui build, 6.9 MB either way)", "94 ms", "<strong>89 ms</strong>", "20.5 / <strong>19.8 MB</strong>"],- ["Bun executable (bui build --bun)", "111 ms", "107 ms", "37.8 / 38.3 MB"],- ["Bun (bun --preload …/register app.js)", "<strong>130 ms</strong>", "243 ms", "<strong>36.4</strong> / 46.6 MB"],- ["Node.js (node --import …/register app.js)", "<strong>147 ms</strong>", "440 ms", "<strong>46.8</strong> / 64.1 MB"],+ ["<strong>QuickJS executable</strong> (bui build, 6.9 MB either way)", "93 ms", "89 ms", "81 ms", "20.4 / 20.4 MB"],+ ["Bun executable (bui build --bun)", "106 ms", "<strong>90 ms</strong>", "94 ms", "37.8 / 38.8 MB"],+ ["Bun (bun --preload …/register app.js)", "<strong>107 ms</strong>", "121 ms", "203 ms", "36.5 / 40.2 MB"],+ ["Node.js (node --import …/register app.js)", "<strong>125 ms</strong>", "135 ms", "393 ms", "52.1 / 55.4 MB"],],- note: "On Node.js and Bun, Svelte's runtime loads from its source files (about 90 modules) and components come from the compile cache; bui build bundles both frameworks ahead of time.",+ note: "On Node.js and Bun, register now serves Svelte's runtime bundled (once, with Bun, into node_modules/.cache) and compiled components from the cache; before, Svelte's runtime loaded from about 90 source modules. The React and Svelte columns ran one after the other, not interleaved. Bun sometimes crashes when a React app quits (after its first frame; 5 of 12 launches here, 11 of 12 for the Bun executable), a bug that predates this work; those launches count for first frame but not for exit time.",},jsFrameworks3000: {caption:- "React vs Svelte, 3,000 animated cells (bench/cells.js): one cell changes per frame, GPU renderer, medians of 3 interleaved runs, one session (2026-11-06)",- columns: ["3,000 cells", "FPS", "CPU per frame", "RAM"],+ "React vs Svelte, 3,000 animated cells (bench/cells.js): one cell changes per frame, GPU renderer, medians of 3 interleaved runs, one session (2026-11-06, after this release's Svelte work)",+ columns: ["3,000 cells", "CPU per frame", "RAM", "JS heap", "JavaScript per update"],+ numeric: [1, 2, 3, 4],+ rows: [+ ["Node 26: plain JS", "37.0 ms", "92 MB", "7.6 MB", "14 µs"],+ ["Node 26: React with signals / with state", "37.6 / 38.1 ms", "<strong>100</strong> / 166 MB", "12.4 / 19.4 MB", "23 µs / 5.2 ms"],+ ["Node 26: Svelte with signals / runes", "39.0 / 39.4 ms", "116 / 117 MB", "20.6 / 24.8 MB", "<strong>17</strong> / 65 µs"],+ ["Bun 1.4: plain JS", "37.4 ms", "81 MB", "2.7 MB", "13 µs"],+ ["Bun 1.4: React with signals / with state", "38.4 ms / (see note)", "<strong>87</strong> / 111 MB", "6.1 / 11.7 MB", "<strong>17</strong> µs / 8.6 ms"],+ ["Bun 1.4: Svelte with signals / runes", "36.8 / 35.9 ms", "97 / 98 MB", "10.3 / 10.2 MB", "19 / 76 µs"],+ ["QuickJS: plain JS", "38.6 ms", "59 MB", "", "28 µs"],+ ["QuickJS: React with signals / with state", "37.8 ms / (see note)", "<strong>60</strong> MB", "", "40 µs / 76 ms"],+ ["QuickJS: Svelte with signals / runes", "38.5 / 37.0 ms", "75 / 75 MB", "", "<strong>36</strong> / 790 µs"],+ ],+ note: "Every variant ran at 26–29 FPS in this session (the machine, not the code), so CPU per frame is mostly BUI's own rendering and differs within noise; the last column is the JavaScript cost of one update alone (500 back to back, each applied and sent to the UI thread). Svelte with signals passes BUI signals as values, which bind their nodes: writes skip Svelte, as React's signal props skip React. Svelte with runes pays Svelte's own flush, which walks the component's effects (3,000 here). React with state on Bun and QuickJS: its 500 back-to-back re-renders (8.6 and 76 ms each) overran the warm-up, so its frame numbers from this session aren't valid.",+ },+ jsFrameworksBefore: {+ caption: "Svelte before and after this release's work, same session as above (medians of 3)",+ columns: ["3,000 cells", "RAM (before / after)", "JS heap (before / after)", "JavaScript per update (before / after)"],numeric: [1, 2, 3],rows: [- ["Node 26: React with state / React with signals", "27.6 / 27.6", "42.5 / 36.9 ms", "150 / <strong>98 MB</strong>"],- ["Node 26: Svelte (runes) / Svelte with signals", "24.8 / 26.6", "41.5 / 38.6 ms", "119 / 118 MB"],- ["Bun 1.4: React with state / React with signals", "24.0 / 25.0", "55.8 / 40.8 ms", "111 / <strong>86 MB</strong>"],- ["Bun 1.4: Svelte (runes) / Svelte with signals", "26.4 / 27.0", "39.3 / <strong>38.2 ms</strong>", "100 / 100 MB"],- ["QuickJS: React with state / React with signals", "8.5 / 27.0", "117 / <strong>37.3 ms</strong>", "67 / <strong>62 MB</strong>"],- ["QuickJS: Svelte (runes) / Svelte with signals", "26.9 / 25.9", "37.5 / 38.7 ms", "76 / 76 MB"],+ ["Node 26: Svelte runes", "123 / 117 MB", "21.7 / 24.8 MB", "85 / 65 µs"],+ ["Node 26: Svelte with signals", "123 / 116 MB", "22.2 / 20.6 MB", "87 / <strong>17</strong> µs"],+ ["Bun 1.4: Svelte runes", "102 / 98 MB", "10.9 / 10.2 MB", "78 / 76 µs"],+ ["Bun 1.4: Svelte with signals", "102 / 97 MB", "11.4 / 10.3 MB", "86 / <strong>19</strong> µs"],+ ["QuickJS: Svelte runes", "76 / 75 MB", "", "790 / 790 µs"],+ ["QuickJS: Svelte with signals", "76 / 75 MB", "", "793 / <strong>36</strong> µs"],],- note: "This session ran at about 27 FPS for every variant, so the absolute numbers aren't comparable with the tables above; compare the rows with each other. Svelte with runes needs no signals: only the cell that changes updates. Svelte with signals passes BUI signals as stores ($style). The same session's React with state cost 45.8 ms and 190 MB on Node before this release's DOM changes.",+ note: "Before: signals as stores ($style), Svelte's own update functions through the DOM, Map attributes. JS heap is sampled without a forced GC, so it includes garbage.",},jsAnim1000: {caption: "JavaScript animation, 1,000 cells",@@ -668,17 +685,17 @@ export const charts = {table: "jsStartup",source: sources.readme,},- "js-frameworks-cpu-3000": {+ "js-frameworks-update": {kind: "groups",- title: "React vs Svelte: CPU per frame, 3,000 cells",- subtitle: "One cell changes per frame; GPU renderer; one session, interleaved runs",- unit: "ms",+ title: "React vs Svelte: JavaScript per update, 3,000 cells",+ subtitle: "One cell changes; the framework applies it and sends it to the UI thread; median of 3 sessions of 500",+ unit: "µs",better: "lower",- series: [{ name: "React + signals", ours: true }, { name: "React + state" }, { name: "Svelte (runes)", ours: true }, { name: "Svelte + signals", ours: true }],+ series: [{ name: "Plain JS", ours: true }, { name: "React + signals", ours: true }, { name: "Svelte + signals", ours: true }, { name: "Svelte (runes)", ours: true }],groups: [- { label: "QuickJS", values: [37.3, 117, 37.5, 38.7] },- { label: "Bun 1.4", values: [40.8, 55.8, 39.3, 38.2] },- { label: "Node 26", values: [36.9, 42.5, 41.5, 38.6] },+ { label: "Node 26", values: [14.1, 23.3, 16.8, 65.3] },+ { label: "Bun 1.4", values: [12.6, 17, 19, 75.7] },+ { label: "QuickJS", values: [28.1, 40.2, 35.6, 790] },],table: "jsFrameworks3000",source: sources.js,