perf: drain initial wall builds within the time budget (charter row 6) - #800
Open
wass08 wants to merge 6 commits into
Open
perf: drain initial wall builds within the time budget (charter row 6)#800wass08 wants to merge 6 commits into
wass08 wants to merge 6 commits into
Conversation
|
I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…). Please try again, rephrase, or reach out if it keeps failing. Error id: d08da89a-c471-4f51-ab16-816f2435e6c2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Metric
Maxi 8× time-to-first-clean after load (charter backlog row 6; the row's
settled < 8 starget contains a 3 s runner quiet window, so the runner now reportsfirstCleanMsalongside it).Three back-to-back PR-vs-main pairs, same machine (a fourth under load average 21–24 discarded as starved); third pair = this tip:
What changed
setScene's hydration token and left on the first frame with no dirty wall and an empty pending-neighbour queue (a document write, live override/transform, or canvas pointer/wheel ends it early). Exposed read-only viaisWallInitialBuildActive().__pascalPerf.batchStats().wallDrain(walls consumed per frame, exit reasons, pending-neighbour length, first-build vs re-invalidation) and awall-initial-buildspan.Gates
--randomize --seed=1);tsc --noEmitcore/viewer/nodes clean; biome clean.?perf-gated, allocation-free diagnostics) plus a pre-existing core test-fixture ordering flake fixed (three seeds green).wiki/architecture/systems.mddescribes the initial-build scheduling.Charter:
plans/performance/editor-scalable-scene-runtime.mdrow 6 (private PR follows with the evidence row and the runner's first-clean / undo-phase sampling).🤖 Generated with Claude Code
https://claude.ai/code/session_01Jmmz2AMwTzcnKsSHHPEMhN
Note
High Risk
Changes core scene load/hydration, undo-adjacent store wrapping, and wall rebuild scheduling—security-adjacent correctness for large imports and first-edit behavior, with many interaction edge cases.
Overview
Introduces a scene hydration boundary around
setScene: elevator opening sync runs synchronously, stair rise/opening normalization is queued via microtasks, and ahydrationTokenis published only after that work completes. Ordinary document writes (including the first edit after load) atomically cancel pending publication or clear an issued token; live overrides/transforms and canvas pointer/wheel also end hydration early.The wall system enters initial build when the token is active: rebuilds follow the existing 8 ms frame budget but without the 8-walls-per-frame cap, heavy walls still get a dedicated frame, and each wall’s first build skips neighbour re-invalidation. Lifecycle state lives in
wall-build-lifecycle(eager canvas subscription +isWallInitialBuildActive()), with optional?perfwallDrain stats. Stair auto-sync and snapshot apply are wired into the same normalization/hydration rules.Includes broad regression tests (hydration ordering, interruptions, batching quiet clock during initial build) and
wiki/architecture/systems.mdupdates.Reviewed by Cursor Bugbot for commit 52b1b5b. Bugbot is set up for automated code reviews on this repo. Configure here.