Status: Accepted (2026-11-27). Supersedes 0003 (storage layout and memory numbers) and 0013 (engine phasing).
Amendment note (2026-11-27, WP-E1): implemented as designed. Measured E1 client totals are 0.512x (4,000 pages) and 0.691x (5M shapes) of the measured baseline. The “Today” columns below underestimate the real baseline (capacity slack, the renderer’s CPU LOD copy, canvas backbuffers:
docs/perf/memory-baseline.md). Measured parts and the updated E2 projection: 0502.
Memory is the user’s top priority. The previous plan kept the engine’s CPU primitive mirror next to a new ~80 B/node document: 5M shapes +130% at first integration and +58% after optimization; website +10%. New hard requirement for both benchmark scenes (4,000 website pages = 682K nodes / 11M primitives; 5M random shapes): total client memory <= +10% vs today at first integration (E1), <= today after optimization (E2).
TextView + bundled metrics;PointsView.
It then computes chunk bounds and LOD impostors from the scratch and uploads with bufferSubData. The GPU instance buffer stays the only full-scene instance copy, in VRAM, unchanged in format and draw path.primStart (Int32). Text/path instance counts live in their records. Per chunk: bounds, LOD groups and the first node handle, from which hit testing and marquee walk nodes in pre-order using doc geometry and cached container world offsets.NodeColumns in shared/src/doc-api.ts):
parent/nextSibling/prevSibling (Int32), x/y/w/h (Float32), kindFlags (1 B: 5-bit kind + 3 flags);| Component | Today | E1 | E2 | |—|—|—|—| | Engine CPU primitive mirror (10 x u32) | 40 | 0 | 0 | | Engine CPU flags / primitive -> object map | 4 + 4 | 0 | 0 | | Engine object table (today start/len/kind/alive/sel/mark; target primStart) | 12 | 4 | 4 | | Chunk metadata (bounds, LOD groups, first node) | 2.4 | 2.4 | 1.4 | | Doc id + id -> handle index | - | 8 | ~0 | | Doc tree (parent, next, prev) | - | 12 | 12 | | Doc sibling key (inline) | - | 8 | 8 | | Doc kindFlags | - | 1 | 1 | | Doc x, y, w, h | - | 16 | 16 | | Doc rotation (lazy; allocated because 15% are rotated) | - | 4 | 4 | | Doc fill / stroke style / corner radius (interned u16) | - | 6 | 6 | | Doc opacity (lazy; all default -> none) | - | 0 | 0 | | Editor selection bitset | (in object table) | 0.125 | 0.125 | | CPU | 62.4 | 61.5 | 52.5 | | GPU: instance 40 + flags 4 + impostors 3.4 (unchanged) | 47.4 | 47.4 | 47.4 | | Total per node | 109.8 | 108.9 (-1%) | 99.9 (-9%) | | Scene total | ~549 MB | ~545 MB | ~500 MB |
| Component | Today | E1 | E2 | |—|—|—|—| | Engine CPU primitive mirror + flags + primitive map (48 B x 11M) | 528 MB | 0 | 0 | | Engine object table (12 B -> 4 B per node) | 8.2 MB | 2.7 MB | 2.7 MB | | Chunk metadata (2.4 -> 1.4 B/primitive) | 26.4 MB | 26.4 MB | 15.4 MB | | Names Map (truncated text + frame names) | ~22 MB | - | - | | Doc nodes (E1 51 B/node: ids 8, tree 12, key 8, kindFlags 1, xywh 16, interned paint 6; E2 43 B) | - | 34.8 MB | 29.3 MB | | Text: record index (lazy 4 B/node) + records (~20 B x 270K) + UTF-8 arena (full content) | - | 20.1 MB | 20.1 MB | | Names (interned; frames only) | - | 0.2 MB | 0.2 MB | | CPU (per node) | ~585 MB (858 B) | ~84 MB (123 B) | ~68 MB (99 B) | | GPU (47.4 B/primitive, unchanged) | ~521 MB | ~521 MB | ~521 MB | | Total | ~1,106 MB | ~605 MB (-45%) | ~589 MB (-47%) |
Budgets exclude growth slack. Today’s arrays grow by 1.6x, so its measured baseline is higher. Target code sizes exactly on snapshot load and grows by <= 1.25x on edits.
tools/bench --memory. Pages are served with COOP same-origin + COEP require-corp so performance.measureUserAgentSpecificMemory() is available. Take the minimum of two readings 10 s apart after load.HeapProfiler.takeHeapSnapshot via Playwright) for attribution: ArrayBuffer backing stores by owner, string bytes, and JS object count, which must not scale with nodes (< 100K objects in either scene).doc.memoryReport() and engine.memoryReport() (CPU typed arrays + GPU bytes from bufferData accounting) give per-part bytes/node to compare with the tables. performance.memory.usedJSHeapSize is logged for trend only (it excludes ArrayBuffer storage).docs/perf/memory-baseline.json before any engine change.transformObjects + upload.NodeColumns changed to the compact layout. Opacity is canonical at 1/255 (rules), so all replicas agree.