Repository navigation
test(bench): the update path's owner is the background drain - #102
Conversation
Phase 0 attributed the update path and its gate fired NO-GO on the delta candidate: `mt_prepare` plus clone/transfer is 3.4% of update10th, 2.3% of updateStorm, and 0.1% of select. The owner it named instead was `bg_replay` at 49.5% / 12.3% / 62.0% — but `bg_replay` is one bucket holding event delivery, render, reconcile, and batch construction, so 62% with no owner inside it cannot aim anything. This splits it. `bgRenderMs` times Octane's `renderBlock` entry, counting only the outermost call so nested renders are not charged twice, and the analyzer reports `bg_render_reconcile` against `bg_replay_other` with a containment check: a render total larger than the replay window it sits in means the two clocks disagree, and no share derived from them is reportable. The half that actually explains the frame is deterministic, not timed. `bgRenderBlocks` counts block renders, reported against the host commands they produced. Milliseconds are host-bound; these counts are fixed for a given app and interaction, which is what makes them gateable — a candidate claiming to cut background cost has to move them, not the wall clock. The harness now reaches into `packages/octane/src` as well as the Lynx package, so the restore test names that file explicitly: a framework source left instrumented would poison every later build. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Item bodies promoted to pure, and the two rows a keyed selection rewrites, are invoked directly rather than through `renderBlock`. The count is a floor on body invocations, and it reads high precisely where those specializations are not applying — which is the signal, but only if the artifact says so. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
The previous commit split `bg_replay` at Octane's `renderBlock`. That boundary is wrong for this app, and provably so: instrumenting it in-process and running the deterministic bench gives zero block renders for both update10th and select at 1,000 rows. Item bodies on the keyed path are invoked directly through the for-block's survivor and call-site caches and never reach that entry, so the stage would have reported a confident zero and hidden the segment it was built to expose. The drain — `flushWork`: render, reconcile, commit, effects — is the real container, and the runtime already guards it against re-entry, so a single accumulator cannot double-count. `bg_flush` now sits inside `bg_replay` under the same containment check, with `bg_replay_other` carrying event delivery, the handler, scheduling, and batch construction. The deterministic counter changes with it. Block renders are not render breadth here; row-body renders are, and the app already counts them in the profile build. The harness now reads that counter out of the background realm alongside the drain count and the host commands, so the report carries the number that answers "did the frame re-render the list" rather than one that is structurally zero. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
The previous commit moved the background split from `renderBlock` to the DOM runtime's `flushWork`. That boundary is unreachable too, and the run said so: `bg_flush` read 0 ms over 0 drains in every cell, so `bg_replay_other` still carried the whole window unattributed. The reason is not a mis-chosen function, it is a mis-chosen renderer. The Lynx background thread reaches Octane through `octane/universal/native`, which is `universal-core.ts` — a different renderer from `runtime.ts`. A profile bundle built with the previous patch contains no trace of it (`bgFlushes` appears zero times in `main.lynx.bundle`, while `bgReplayMs` and `papiCreateMs` are both present), so the stage was reporting a confident zero for a function the measured thread never calls. The drain is `UniversalRoot.prepare()`: render, reconcile, and host-batch construction. It re-enters, so only the outermost call is timed, and it also runs outside any replay (the first screen prepares too) while `bgReplayMs` covers only the replay window — so the accumulator is gated on a window flag the transport patch now publishes. Ungated the drain would exceed its own enclosing stage, which analyze.mjs already refuses to report. The counters are plain globals rather than fields on the Lynx profile record. This patch does not own that record's shape, and creating it here with a partial default would leave `lynxWireProfile()` adopting it and accumulating onto undefined. run.mjs folds them into the background snapshot exactly as it folds the app's row-body counter. Verified before trusting a full run: at 1,000 rows the drain is 15.3 ms of a 15.5 ms replay window on update10th and 12.1 of 12.3 on select — 98-99%, not zero. The stage is renamed `bg_flush` -> `bg_prepare` accordingly, and the Phase 2 re-aim gate now reads a segment that exists. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
…dary Same-window, n=5, quiet host (load 1.10 / 4 CPUs at start), AB/BA, fresh page per sample, Chromium 141. The background drain owns the update path, and `bg_replay_other` is now provably empty rather than merely unattributed: | cell | bg_prepare | bg_replay_other | presentation_residual | |---|---:|---:|---:| | update10th@10k | 96.0 ms (36.0%) | 0.6 ms (0.2%) | 127.6 ms (47.9%) | | updateStorm@10k | 100.8 ms (9.9%) | 1.0 ms (0.1%) | 791.0 ms (77.3%) | | select@10k | 64.2 ms (43.3%) | 0.3 ms (0.2%) | 76.3 ms (51.5%) | Event delivery, the handler, scheduling, and the commit hand-off together are 0.1-0.2% of the replay window. Everything else in it is render, reconcile, and host-batch construction. `select` is the cell that decides the re-aim: one row's class flips in a 10,000-row table, producing 1 row-body render, 1 host command, and 289 B on the wire — against 64.2 ms of background drain. The output is change-sized and the drain is tree-sized. The instrumentation caveat that qualified Phase 0 is gone. Profile/control is 0.96x on update10th, 1.07x on select, 0.92x on updateStorm, and 0.93x on append — within noise in both directions, versus 1.40x/1.47x in the Phase 0 window. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Same host, same bundles (--skip-build), quiet at both starts, n=5, taken ~2.5 minutes after the 10k window. The drain is nearly independent of change size, and the strongest evidence is same-window rather than across the ladder. At 10,000 rows the three mutation cells differ in change size by three orders of magnitude and in drain by less than a factor of two: | cell | row renders | host commands | bg_prepare | |---|---:|---:|---:| | select@10k | 1 | 1 | 64.2 ms | | update10th@10k | 1,000 | 1,000 | 96.0 ms | | updateStorm@10k | 4,000 | 4,000 | 100.8 ms | The 1k window repeats the shape: select 1 render / 12.1 ms against update10th 100 renders / 16.8 ms. Across the ladder, `select` holds its change fixed exactly — one row's class, 1 row-body render, 1 host command, 289 B on the wire at both scales — and the drain still moves 12.1 ms -> 64.2 ms for 10x the rows. The per-sample ranges do not overlap ([12.1, 13.8] against [60.0, 128.0]). Fitting a constant plus a per-row term over the two points gives roughly 6 ms fixed and ~5.8 us per row of untouched list. Absolute milliseconds are host-bound and the two windows are adjacent rather than interleaved, so the ladder is the weaker of the two arguments; the same-window change-size comparison above is the one that carries the claim. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
The L0 spec's landed-increments section gets the Phase 2 entry: the two boundaries that read zero and why, the corrected split, the same-window evidence that the drain is tree-sized while its output is change-sized, and the source-level mechanism — `prepareOwnedUpdate` refuses transported roots, so every Lynx background update takes the full-root path. The roadmap consequence is stated where the next slice will look for it: the lever is a scoped commit for transported roots, which needs the sub-tree ACK/rollback protocol the v2 delta protocol's instance-addressed pairs were built to make expressible. `updateStorm` is excluded from any such claim, since 77.3% of it is the flush/layout residual. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
The stage split established that the background drain owns the update frame, but it established it in milliseconds, which are host-bound and cannot carry a gate. This adds the deterministic half of the same fact. `reconcileChildren` is the reconciler's per-child entry, and the number of child blueprints it visits is fixed for a given app and interaction. Counted under the same replay-window flag as the drain timer, so first-screen reconciliation stays out of it. Across five samples per cell the count has zero spread: | cell | row renders | host commands | wire out | reconciled blueprints | |---|---:|---:|---:|---:| | select@10k | 1 | 1 | 289 B | 10,042 | | update10th@10k | 1,000 | 1,000 | 70,022 B | 11,041 | | updateStorm@10k | 4,000 | 4,000 | 223,539 B | 11,041 | Two deterministic counts for the same interaction, disagreeing by three orders of magnitude: row renders already track the change, reconciled blueprints track the list. That is the re-aimed target stated as a number a candidate has to move, rather than as a share of a wall clock. Also fixes a real hazard the restore test caught. Instrumenting `universal-core.ts` from two separate update() calls made the second call record the already-instrumented text as the pristine original, so restore would have left a framework source patched and poisoned every later build. The two patches are now one transform, and update() throws if a file is claimed twice. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Phase 3 was specified as same-window flag on/off over Phase 2's delta path, then wired into ratios.json. Phase 2's decision gate re-aimed away from that path, so there is no flag to toggle. Recorded as such rather than given an invented subject. What Phase 3 can deliver against the actual Phase 2 outcome is what a gate needs: reconciled child blueprints per replay drain, deterministic with zero spread, disagreeing with row renders by three orders of magnitude. The semantic floor is the changed-rows model the wire gates already use, so select@10k stands at a factor of ~235. The entry also states why it is not in ratios.json yet: that gate reads uninstrumented sources in-process, so it needs a permanent build-flag-gated counter in universal-core.ts, and landing one ahead of the change it exists to gate would pin today's cost as though it were the contract. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
1k re-recorded with the visit counter, n=5, --skip-build so both windows share the same bundles. Every count has zero spread across five samples, so the ladder is exact rather than approximate: | cell | 1k | 10k | model | |---|---:|---:|---| | select | 1,042 | 10,042 | rows + 42 | | update10th | 1,141 | 11,041 | rows + changed + 41 | | updateStorm | 1,141 | 11,041 | rows + changed + 41 | `select` holds its change fixed exactly — 1 row-body render, 1 host command, 289 B at both scales — so the whole movement is list size. Its drain tracks it: 12.4 ms at 1k, 73.2 ms at 10k. The semantic floor is the changed-rows model the wire gates already use, which for `select` is 1 plus the app's fixed chrome. The standing debt is therefore a factor of roughly 235 at 10k, and it is deterministic enough to assert. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
…attribution Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
The Phase 3 entry rounded the model to `rows + changed + 42` and the resulting debt to ~235. The ladder pins both exactly: the constant is the app's fixed chrome, 41, and it reproduces at both scales in all three cells — select 1,000+1+41 = 1,042 and 10,000+1+41 = 10,042; update10th 1,000+100+41 = 1,141 and 10,000+1,000+41 = 11,041. The changed-rows floor for select is therefore 42, and the standing debt at 10k is 239x. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
|
| file | in the full run | alone on this head | on origin/new-lynx |
verdict |
|---|---|---|---|---|
dropzone/tests/probes/hydration |
timeout 5000ms | timeout (load 0.78) | same timeout | pre-existing |
monaco-editor/tests/browser/editor.browser |
locator.click timeout |
same (load 1.18) | same | pre-existing |
drei/tests/browser/upstream-e2e |
waitForFunction timeout |
same (load 2.37) | same | pre-existing |
octane/tests/browser/suspense-hydration |
focus/selection assertion | [+0,+0] vs [2,9] (load 1.77) |
same assertion | pre-existing |
rspeedy-plugin-octane/tests/native-demo |
expected false to be true |
same (load 1.84) | same assertion | pre-existing |
aria/tests/package-boundary |
beforeAll timed out 10000ms |
6/6 pass (load 0.08) | — | load-sensitive setup |
octane/tests/react-hosted/web3-island |
beforeAll timed out 10000ms |
2/2 pass (load 0.44) | — | load-sensitive setup |
The last two are the two file-level entries. Both spend their beforeAll
building production bundles or executing an SSR fixture, against a fixed 10-second
hook deadline, while 2,193 files share four cores — aria runs esbuild and
vite consumer builds there, web3-island runs executeHydrationFixture. Given
the machine to themselves they finish comfortably inside it. That is a property
of the deadline and the box, not of the diff, and not something this PR can fix
or should mask.
What this does not claim
All five failures that reproduced on this head reproduce identically on the base
branch, and are recorded as pre-existing rather than as fixed — this PR touches
none of them. The two hook timeouts are recorded as load-sensitive, which is a
weaker claim than "flaky": they fail predictably when the machine is saturated
and pass predictably when it is not, and a slower CI box would fail them the same
way.
Generated by Claude Code
`pnpm format:check` fails on the stack for three generated JSON results, which blocks the gate for every branch above them. All three are formatted correctly on `new-lynx`; the unformatted copies came in with this stack: - `stages/results/live-1000.json` and `live-10000.json` were rewritten by `888d9034f` and `88e9db5f0`, first carried by `perf/lynx-bg-replay-attribution` (#102). - `prototype/results/u0-block-core-counts.json` is new in `781e4fca3`, on `test/lynx-u0-block-counts` (#107). Fixed forward here rather than at the source, because both of those branches are published and under review and repairing them in place would rewrite history four and two branches deep. Nothing but whitespace changes: each file reparses to a byte-identical JSON value. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
…the harness README Review follow-up: the README the measurement records cite as the harness contract still described only create/replace/append and a bg_replay stage the mutation-cell reports no longer emit un-split. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YHfFsy9CLaRovTFH8pTGyY
Summary
Phases 2 and 3 of the revised plan on #66, both re-aimed by Phase 0's decision
gate. One attribution slice; splitting them would have produced a PR whose diff
is three lines of counter.
Stacked on #101 (Phase 1) → #100 (Phase 0) → #97.
Phase 0 fired NO-GO on the delta candidate and named
bg_replayas the owner —but
bg_replaywas one bucket holding event delivery, the handler, render,reconcile, batch construction, and the outbound self-check. 62% with no owner
inside it aims nothing. This splits it, reads the result, and turns the result
into a number that can be asserted.
The verdict flipped to GO. Same-window, n=5, quiet host, AB/BA, fresh page
per sample, Chromium 141:
bg_preparebg_replay_othermt_prepare+ wirepresentation_residualEvent delivery, the handler, scheduling, and the commit hand-off together are
0.1–0.7% of the replay window. The window is the drain. Phase 0's
instrumentation caveat is gone too: profile/control is within noise in both
directions across all four cells, against 1.40×/1.47× in the Phase 0 window.
The drain is tree-sized while its output is change-sized, and Phase 3 states
that as a deterministic count rather than a share of a wall clock. Zero spread
across five samples in every cell, at both scales:
Row renders track the change; blueprints track the list, exactly —
selectisrows + 42at both scales,update10thisrows + changed + 41.selectholds its change fixed (1 render, 1 command, 289 B at both scales), so the whole
movement is list size, and its drain follows: 12.4 ms at 1k, 73.2 ms at 10k. The
semantic floor is the
changed-rows-modelthe wire gates already use, so thestanding debt is a factor of roughly 235 at 10k.
The mechanism is in the source, not inferred from the numbers.
prepareOwnedUpdateinuniversal-core.tsis the scoped, O(change) update path.It returns
nullunconditionally whenthis.transport !== null, androot.tsconstructs every Lynx background root with a transport, so every Lynx update
falls through to the full-root
prepareWithReplay. The guard's own comment givesthe reason: a transported commit is acknowledged against a whole-tree version, so
a scoped batch would need its own ACK/rollback protocol on the far side.
Why the boundary moved twice
Both earlier boundaries reported a confident zero, and the second is the more
instructive failure.
renderBlockis never reached on the table's mutation path: item bodies areinvoked directly through the keyed for-block's survivor and call-site caches.
The DOM runtime's
flushWorkis never reached at all — not a mis-chosenfunction but a mis-chosen renderer. The Lynx background thread reaches Octane
through
octane/universal/native, which isuniversal-core.ts, a differentrenderer from
runtime.ts. Proof rather than argument: a profile bundle builtagainst that patch contains zero occurrences of its counter, while the
neighbouring
bgReplayMsandpapiCreateMsare both present in the same bundle.That one was published to a full 10k run before it was caught, and it produced a
wrong NO-GO verdict on this very re-aim. The rule the harness now follows:
confirm a non-zero count at low scale before trusting a full run. Applied here as
a 1k smoke first (drain 15.3 ms of a 15.5 ms replay window on update10th).
On Phase 3's stated subject
Phase 3 was specified as same-window flag on/off over Phase 2's delta path, then
wired into
ratios.json. Phase 2's gate re-aimed away from that path, so thereis no flag to toggle. Recorded as such rather than given an invented subject.
The counter is not in
ratios.json, and the reason is a constraint ratherthan an omission: that gate runs
workload.tsin-process against uninstrumentedsources, so it needs a permanent build-flag-gated counter in
universal-core.ts.Landing one ahead of the change it exists to gate would pin today's cost as
though it were the contract, so it belongs as the first commit of the
scoped-commit slice.
Changes
stages/instrument-source.mjs— timesUniversalRoot.prepare()and countsreconcileChildrenvisits onpackages/octane/src/universal-core.ts, bothgated on a replay-window flag the transport patch publishes so the first
screen stays out of the update stage. Counters are plain globals rather than
fields on the Lynx profile record, which this patch does not own.
stages/analyze.mjs—bg_prepare/bg_replay_otherwith the containmentcheck
papi_element_creationalready uses againstapplyMs.stages/run.mjs— folds the drain and visit counters out of the backgroundrealm, reports renders / drains / blueprints / commands per cell, carries the
re-aim verdict.
stages/results/live-10000.*,live-1000.*— re-recorded.docs/lynx-specialized-target-l0.md— §8 Phase 2 and Phase 3 entries.Validation
pnpm format:check— viapnpm format:filesover every changed pathpnpm typecheck— exit 0pnpm test— running against the final diff; result in a follow-up commentnode --test benchmarks/lynx-table/stages/*.test.mjs— 17/17reportable: trueon bothRisk / follow-ups
framework-source patch is applied to a temporary copy and restored, pinned
byte-for-byte by the restore test.
universal-core.tsfrom twoupdate()calls made the second record the already-instrumented text as the original, so
restore would have left framework source patched and poisoned every later
build. The patches are now one transform, and
update()throws if a file isclaimed twice.
sub-tree ACK/rollback protocol on the main thread — a runtime and transport
change, large enough to want review before implementation. It is also what
makes the v2 delta protocol (feat(lynx): cut the delta protocol over to instance-addressed v2 #101) load-bearing: instance-addressed
(instance, slot)pairs are what makes a sub-tree batch expressible.updateStormis excluded from any claim about this lever: 78.4% of it is theflush/layout residual, which bounds what any upstream change can win.
stages/analyze.test.mjsresolves a repository path relative to the processcwd, so the stage tests only pass from the repo root. Pre-existing and
untouched; also noted on test(bench): Phase 0 update-path attribution — delta candidate is NO-GO #100.
contract excludes the standard coercions (
String/Number/Boolean) ascallees and as free identifiers, so one
{String(row.id)}in a row componentdrops the whole keyed list from the DEP-PURE survivor promotion — compiled
flags 14 → 10 on the real bench app. Admitting them (fail-closed on a
member-call argument or a module that rebound the name) flips it back. It moves
no measured number at 1,000 rows. Written up on Execution plan (#58): complete L2, then drive L4→L6 — full context handoff #66 rather than landed
here, because an optimization with no measured effect is not one.
Provenance
agent-authored)Generated by Claude Code