Repository navigation
perf(lynx): stop describing detaches a clear's own destroy performs - #249
Merged
Merged
Conversation
Expanding a `destroy-run` against ordinary records synthesized one `event` command per listener on its way to the `destroy` that retires the same host. `destroy` already ends the listener lifetime: its apply calls `removeAllNativeEvents` with the teardown flag read live, in the apply phase, rather than decided when the run was expanded. The detach commands existed only to describe it. Measured on the benchmark table row (view.row over three text cells with their carriers, two tappable), through the records-map route a table clear actually takes once anything on the page owns a higher host id: per row before after commands 10 8 destroy 7 7 remove 1 1 event 2 0 At 10,000 rows that is 100,000 synthesized commands down to 80,000. A container that owns a native list keeps describing them. A list can hand a recycled element back still bound, so its unbinds stay explicit — and leaving them to `destroy` would also reorder the PAPI stream from unbind-then-remove to remove-then-unbind, which is not a change worth making in the one case that cannot be exercised from this harness. The `destroy` apply operation also stops carrying a copy of the record's events. Neither apply branch that reads an operation's `events` is the destroy branch, which reads the live `state.nativeEvents` entry instead, so the snapshot was one map allocation per destroyed host that nothing read. Dropping the field lets the compiler prove that. Wall clock is not claimed. At 8,000 rows the clear measures 239 ms before and 225 ms after by median of seven, inside a spread of roughly 50 ms in this environment; the command and allocation counts are the deterministic half and the only half asserted. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
#241 sets a retention oracle on `heapMtsAfterClear@10k` and nothing in this repository names that metric, so grepping `benchmarks/` for it returns nothing and invites the conclusion that the oracle cannot be measured. It can: the instrument lives in the campaign harness and reads the metric over CDP. Writes down what the instrument does, why a post-collection reading and a retained peak are different quantities that do not settle each other, how to build a single entry bundle per arm rather than the whole row ladder, and how to drive the memory block directly instead of paying for every latency case first. Includes the units trap: the harness records bytes, #241 quotes decimal MB, and the obvious `/1024/1024` prints MiB — a 4.9% difference, wider than most changes move the number. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
This was referenced Aug 30, 2026
Gate-review fix on the E2 train: the subsumed-detach skip keyed on the batch's whole destroy set, so a batch that destroys an id and re-creates it would skip a detach on the new incarnation, leaving the native binding installed on a live element. The skip now asks whether a destroy of that id comes after the detach; red-verified with a destroy/re-create/bind/ unbind batch. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YHfFsy9CLaRovTFH8pTGyY
Huxpro
changed the base branch from
perf/lynx-teardown-mirror-verdict
to
new-lynx
August 30, 2026 12:50
Huxpro
marked this pull request as ready for review
August 30, 2026 12:50
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.
Summary
E2 proper, first cut. Stacked on #248 → #245 → #243 — review in that order.
Attribution first, per #241. A deterministic probe over the benchmark row shape
priced a table clear at 10 synthesized commands per row, and found that
2 of the 10 describe work the next command already performs. They are gone.
Why
The clear has two routes, and they are not close:
prepareDirectFullTeardown)expandRecordsRunTeardown)Same container, same program, same final tree, same host-call count (#245 made
both one call per row). The only difference is whether the incremental compact
accepted — and parking a single explicit host above the run's id space is enough
to decline it, which is the situation any page with a toolbar is in.
That 13× is the headline E2 finding, and it is not what this PR fixes.
Closing it means giving the records-map route its own certifier, which is a
design change, not an overnight one. Reported to #230 with the sequence answer;
this PR takes the part of the gap that is provably dead work.
The dead part
Expanding a
destroy-runemitted, per benchmark row:destroyevent(detach)removeThe 2 detaches are redundant with the
destroythat retires the same host inthe same expansion.
destroy's apply already callsremoveAllNativeEvents(state, node, teardownMaySkipUnbind())— the samefunction the detach command's operation would reach, with the teardown flag read
live in the apply phase rather than decided when the run was expanded. Since
#245 the lowering was already declining to journal them; this stops building
them.
Verified, not assumed: instrumenting the expansion shows
{destroy: 7000, remove: 1000, event: 2000}per 1,000 rows before and{destroy: 7000, remove: 1000}after.Changes
expandRecordsRunTeardowngains one predicate,state.lists.size !== 0:commands at 10k rows.
[detach][remove][destroy]order. A list recycles elements the driver does notown and can hand one back still bound, so its unbinds stay explicit; leaving
them to
destroywould also reorder the PAPI stream from unbind-then-remove toremove-then-unbind. Not a change worth making in the one case this harness
cannot exercise. Reading the predicate at expansion time can only ever describe
more work than the apply performs, so the conservative direction is safe.
Separately, the
destroyapply operation stops carryingnew Map(record.events).Both sites that read an operation's
eventsare therecreateandvisibilitybranches; the destroy branch reads the live
state.nativeEventsentry for thenode. The snapshot was one map allocation per destroyed host that nothing read —
70,000 of them at 10k rows. Dropping the field from the union lets the
compiler prove nothing else wanted it.
Validation
pnpm format:check— viapnpm format:fileson both changed filespnpm typecheck— see belowpnpm test— not re-run; see belowtargeted tests:
npx vitest run --project lynx— 48 files, 731 passed (730 before, +1 new).New regression, red-verified.
releases a cleared run's listener journal through its destroyis the companion to perf(lynx): stop describing unbinds a teardown's own destroy subsumes #245's per-row oracle: that one pinswhat a clear spends, this one pins that it still releases. It clears a
4-row run through the records-map route, asserts the clear costs
{remove: 4, flush: 1}, then asserts disposal afterwards emits nosetEvent— a listener left in the journal would outlive its record and beunbound at disposal. Broke
destroy'sremoveAllNativeEventscall and itwent red with 8 stale
setEvents (2 listeners × 4 rows); restored.pnpm typecheck:files—host-driver.tsclean.host-driver.test.tsreports40 errors, all pre-existing: stashed, re-ran, got 40;
diffof the sortedmultisets is empty.
pnpm sync— clean.pnpm test(repo-wide) was run on the perf(lynx): stop describing unbinds a teardown's own destroy subsumes #245 ancestor and its 3 failures provenpre-existing there against base
8938c1260. This commit touches the same twofiles plus a changeset; the lynx project suite is the meaningful gate.
Risk / follow-ups
reordering of the train. E2 → E3 → E1 stands. What changes is E2's own
content: the 15.5× route gap means the remaining E2 work is "make the
declined-compact route cost what the certified route costs", not "make
teardown cheaper". Teardown is already cheap on one of its two routes. Full
reasoning and the sequence answer are on The create residual: attribute it, tax-test it, then extend compiled programs to steady-state mounts (E-train) #230.
1.15× react and
heapMtsAfterClear≤ upstream both need the web harness, andthe app cannot be built in this environment (
npx rspeedy build→ 404 from theproxy). What is verified is deterministic: 20% fewer synthesized commands, one
fewer map allocation per destroyed host, clear-time event calls still 0.
239 ms before, 225 ms after by median of seven warm samples — inside a
±50 ms spread in this container. A 20% command cut ought to show, and it may;
this environment cannot say so. The counters are the claim.
both routes exist and what each costs; it does not prove which one a device
build resolves to, because that needs the browser harness. The earlier
dispatch-site instrumentation suggested the declined route, which is why this
PR targets it — but treat that as hypothesis, not verified.
new-lynx,since both touch
host-driver.tsand the standing rule is that the laterchange yields to the earlier. No force-pushes on any open PR.
claude/octane-issue-66-phase-a-7wz97z, butcreate-a-prmandates aperf/topic branch so
label-pr.ymlcan derive the type label. Topic branch used;flagging rather than silently picking a side.
Provenance
agent-authored)Generated by Claude Code