Linora

EN2 results: remote apply cost, chunk insertion, TRANSFORM bake, E2 engine memory

Wave 3, engine performance (ADRs 0503-0507). Before = the E1 engine (HEAD of the wave); after = the EN2 working tree. Reference machine (Apple M4 Pro, Chrome 158), shared with six other agents building and benchmarking at the same time.

Remote apply: 10K SETs (node tools/bench/remote-apply.ts)

Node, real doc and engine derivation, CPU sink in place of the GPU. Each batch is 10K SET ops applied as a sequenced (remote) batch, then synced as Engine.update does it (ADR 0503). Medians of 5 runs.

Raw: en2-remote-apply.json.

Scene Case Kind View E1 frame EN2 frame (doc + engine) later frames idle
website clustered fill page 12.4 ms 1.37 (1.01 + 0.36) 0 7.7 ms
website clustered x/y page 12.4 ms 3.02 (0.97 + 2.06) 1 (1.8 ms) 8.1 ms
website spread fill page 374.5 ms 2.59 (1.52 + 1.07) 0 314 ms
website spread x/y page 364.3 ms 3.18 (1.16 + 2.02) 3 (5.1 ms) 312 ms
website clustered fill / x/y fit-all ~12 ms 3.02 / 3.17 3 (6.1 ms) 0
website spread fill / x/y fit-all ~380 ms 3.29 / 3.33 ~150 (310 ms) 0
5M shapes clustered fill / x/y page - 1.40 / 2.24 0 1.2 ms
5M shapes spread fill / x/y page - 3.94 / 4.36 (doc 2.4) 0-2 430 ms
5M shapes spread fill / x/y fit-all - 4.44 / 4.48 (doc 2.0) ~183 (423 ms) 0

Result: the 4 ms target is met in every website case and for clustered edits on 5M shapes. Spread edits on 5M shapes come to 3.9-4.5 ms: the doc’s own apply of 10K random SETs on a 5M-node doc is ~2 ms of that, and the engine’s marking (random access into 20 MB per-node arrays) ~1.5-2.5 ms.

E1 (WP-E1, same scenes) re-derived every dirty chunk in the applying frame: 11.3 ms clustered and 455 ms spread in the browser. This Node bench gives E1 12.4 ms and 364-375 ms.

What changed (ADR 0503):

When everything is on screen (fit-all), a spread batch still has to refresh every chunk’s LOD impostors. That work runs over ~140 frames of <= 2 ms each (a progressive refresh) instead of one 0.4 s frame.

Structural edits (ADR 0504) and bulk moves (ADR 0505)

node tools/bench/gpu-check.ts --big: Chrome on the bench harness. Each step edits through the session, then compares the GPU buffers with a derivation from the doc (Engine.verifyGpu, a readback). Scene: 30 pages + 300K shapes; the last row uses 5M shapes.

Step doc apply engine CPU GPU path GPU buffers vs doc
draw a rect inside the first page (mid-order create) 0.38 ms 1.06 ms chunk insertion equal
grow a text in the first page past its slot 0.29 ms 0.85 ms chunk insertion equal
send the last page to the back (move) 4.62 ms 1.04 ms hole + insertion equal
TRANSFORM of every top-level node (30 pages + 300K shapes) 8.6 ms 8.7 ms bake by ranges (GL calls 0.4 ms) equal
TRANSFORM of every other shape, selected 2.4 ms 5.2 ms bake by selection (0.06 ms) equal
10K spread fill SETs 4.9 ms 2.6 ms deferred derivation equal after flush
5M shapes: TRANSFORM of every shape (bulk move) 455 ms 58 ms bake by ranges (0.1 ms) equal

The first bake used to pay ~50 ms to link its program; the program is now linked when the renderer is created.

Before EN2, each structural row was a tail layout (~0.65 s on the 4,000-page site), and a bulk move re-derived every chunk it touched (0.45 s for 5M shapes; above 200K roots the editor refused it). Typing into a text near the start of a big doc opens chunks once and never lays out the tail (engine test).

Memory (ADR 0024 gate, E2 limit 1.00x; ADR 0506)

node tools/bench/run.ts --memory --memory-limit 1.00, against memory-baseline.json. Raw: en2-memory.json.

Scene E0 baseline E1 EN2 Ratio
website: 4,000 pages, 662,190 nodes, 11,028,450 instances 1,204.9 MB 617.2 MB 614.9 MB 0.510x
5M shapes 879.1 MB 607.5 MB 605.6 MB 0.689x
Engine CPU part website E1 website EN2 shapes E1 shapes EN2
primStart (4 B/node) 2.66 MB 2.66 MB 21.68 MB 21.68 MB
scratch (stage, LOD and query scratch) 3.46 MB 1.67 MB 3.38 MB 1.59 MB
chunk metadata 1.69 MB 0.91 MB (0.08 B/instance) 0.77 MB 0.41 MB
selection 0.08 MB 0.08 MB 0.68 MB 0.68 MB
total 7.9 MB 5.3 MB 26.5 MB 24.4 MB

GPU memory is unchanged: 499.8 MB (website) and 227.1 MB (shapes). One regression was found and fixed during the run: the list of created handles from the 5M-shape bulk create stayed alive (32 MB, +0.034x). Scratch arrays grown by one big edit are now dropped afterwards.

Perf gate (npm run bench: interleaved ABBA, 5 runs per tree)

Medians of 5 interleaved runs per tree, headless; uncapped fps, vsync sweeps. “After” is the working tree, which also held small uncommitted edits by other agents (comments only in packages/editor). Raw: en2-gate.json, en2-gate-shapes.json, en2-dragui.json.

Row Before After Change
website view fps 742.7 749.8 +1.0%
website transform fps 546.4 570.1 +4.3%
website tour fps 865.1 867.6 +0.3%
website worst-zoom GPU 3.78 ms 3.76 ms -0.5%
shapes view fps 1017.3 1012.7 -0.5%
shapes transform fps 729.4 699.9 -4.0%
shapes worst-zoom GPU 6.90 ms 6.97 ms +1.0%
website drag-ui fps (web app, panels open) 102.1 101.1 -1.0%
shapes drag-ui fps 110.3 108.2 -1.9%

All rows pass.

Headed worst-zoom GPU (absolute budget <= 3.6 ms, exclusive machine slot)

node tools/bench/run.ts headed (vsync, display at 120 Hz) on the harness production build, in an exclusive slot. HEAD was measured in the same slot (--ref HEAD) for comparison. Raw: en2-headed.json.

  EN2 HEAD (same slot)
website worst-zoom GPU 4.09 ms (at 4x fit) 5.02 ms (at 3x fit)
shapes worst-zoom GPU 5.65 ms (at 2x fit) 5.31 ms (at 2x fit)
website view / transform / tour fps 111.3 / 118.3 / 115.9  
shapes view / transform fps 120.2 / 115.6  

The 3.6 ms budget is not met by either tree on this machine today (load average 2.6-3.8 with background processes). EN2 is within noise of HEAD, so it does not move the number; E0 recorded 2.9-4.3 ms for both trees under similar load. The absolute budget needs a quiet-machine run in P3. Frame times hold the refresh rate in every benchmark. run.ts absolute mode now serves a production build of the harness (--ref picks a tree): its dev server lacked the bench session module.

Behaviour parity (node tools/bench/parity.ts)

44/44 states equal. 42/44 screenshots are identical; the other two differ only by ED1’s new frame-name labels on the editor overlay, not by engine output.