#476
perf(runtime): layout memoization, desktop budgets, virtual-list row reuse, and animation continuity
Summary
- Layout memo. Every ancestor re-measured its subtree while distributing space, so layout was O(nodes × depth). Intrinsic size and wrapped height are now memoized per layout pass, keyed by widget id and the fields measurement varies.
- Desktop budgets. Native desktop targets allow 4096 commands, 2048 widget nodes, 32768 path elements, and 32 registered images per view. Past the old budgets a dense view (mixer strips, board traces, timeline regions) was refused and froze on its last frame. Wasm and test builds keep the smaller budgets, and image pixels are still allocated per used slot.
- Virtual-list reuse. Scrolling a virtual list re-windows only when the visible span nears the edge of the mounted rows, instead of rebuilding the whole app per scroll event. Fixed-height lists qualify as they are. Variable-height lists opt in with
exact_extentswhen their extent callback returns real row heights. - Animation-frame invalidation. A looping animation (spinner, skeleton) now dirties its own bounds instead of the whole view.
- Motion continuity.
- The model animations hook no longer cancels runtime-owned control motion (a switch thumb, a caret) started by the same interaction.
- Model motion starts at input time rather than the last presented frame, and is armed before the rebuilt tree is published.
- A hover-delay deadline on an idle surface requests a frame.
- Checkboxes, switches, and toggles follow model-side flips.
textSpanRunCommandIdis public, so an app can animate one run of a paragraph.
Verification
zig build teston macOS with Zig 0.16.0: passed.scripts/gate.sh fast: every step passed exceptexamples-mobile, which needs the Android NDK. The NDK isn't installed here, and upstreammainfails the same way.- New tests:
virtual list keeps mounted rows while scrolling inside their coverage,exact variable rows reuse their mounted window until coverage runs low,canvas animation timeline starts from pending input instead of a stale frame,model render animation refresh preserves runtime-owned motion, andmodel-driven boolean controls follow source-side flips across rebuilds.
@rdev is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.