Repository navigation
perf(lynx): drop the teardown record mirror - #248
Merged
Merged
Conversation
A `mount-template-run` whose incremental compact declined copied every accepted record into a second `LynxDenseHostRecordStore` and kept it live until the next batch, so a later `destroy-run` could be expanded from the run's shape instead of from the record map. Order 3 priced that copy: +31.64 MB retained peak to release 2.12 MB, and `destroyRunExpandMs` is 13.71 ms of a 372 ms clear. #243 established that both routes describe the same teardown, and #245 made both cost one host call per row. The mirror never earned its retention. Removing it also shortens `prepareDirectFullTeardown`'s refusal list by one condition, so the certified direct plan is reachable in a case where a live mirror previously blocked it. The differential test #243 added silently became vacuous once the mirror was gone — both arms took the record-map route — so it is rewritten as a dense-store-vs-record-map differential. The two routes publish handle deltas in different shapes (one `destroy-run` vs nine `destroy`s), so it normalizes both to the set of retired `id:generation` identities and asserts the host-call sequences match exactly. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
This was referenced Aug 30, 2026
Huxpro
changed the base branch from
perf/lynx-clear-skips-redundant-unbinds
to
new-lynx
August 30, 2026 12:49
Huxpro
marked this pull request as ready for review
August 30, 2026 12:49
1 task done
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
The teardown-mirror verdict from #230 Order 3, landed. Stacked on #245
(
perf/lynx-clear-skips-redundant-unbinds) — target that branch, review #243 →#245 → this.
A
mount-template-runwhose incremental compact declined copied every acceptedrecord into a second
LynxDenseHostRecordStoreand retained it until the nextbatch, so a later
destroy-runcould be expanded from the run's shape ratherthan from the record map. The copy is gone.
Why
Three independent measurements say the mirror never earned its retention:
issue57-clear-teardown.jsondestroyRunExpandMs13.71 ms of 372 msAnd two changes removed its remaining justification:
route describe the same teardown — same retired handles, same host calls.
longer buying a cheaper call sequence either.
A cache that costs 15× what it releases, to save 3.7% of the operation it
accelerates, on a path that now produces byte-identical output either way, is
not a cache. It is retention.
There is also a second-order gain:
prepareDirectFullTeardown's refusal listloses the
state.teardownRecords !== nullcondition, so the certified directplan is reachable in one more case than before — a case where a live mirror
previously blocked the very path that is cheapest.
Changes
packages/lynx/src/core/host-driver.ts— 14 sites, net −50 lines:new Map(state.records)andseeded a fresh dense store from it;
LynxHostState.teardownRecordsand its four assignment sites (adopt, commit,reset, dispose);
teardownDenseon themount-templateoperation type, itsconditional spread into
operations.push, and theoperation.teardownDense?.setNode(...)write in the node-binding loop;teardownMirrorCandidateandacceptedTeardownRecords;state.teardownRecords !== null ||fromprepareDirectFullTeardown'srefusal list;
state.records instanceof LynxDenseHostRecordStore ? state.records : null.packages/lynx/tests/host-driver.test.ts— the test #243 added had silentlygone vacuous. With the mirror deleted, both of its arms took the record-map
route, and the whole suite passed 730/730 while the differential proved nothing.
Caught by asking why a deletion cost zero tests, not by a failure.
Rewritten as a dense-store vs record-map differential:
view(class binding) →text→#text(value binding) — sodynamicRoutesyields a dense-eligible program;LynxDenseHostRecordStoreand the run tears down through it;declines, and the same teardown resolves through the record map;
[[false, []], [true, ["records-map"]]].The two routes legitimately publish differently — dense emits one
destroy-rundelta, the map emits ninedestroys — so asserting raw deltaequality is wrong. The test normalizes both to the sorted set of retired
id:generationidentities (9 handles either way) and asserts the host-callsequences are equal, which is the property that actually matters.
Validation
pnpm format:check— viapnpm format:fileson all changed files, cleanpnpm typecheck— see the multiset note belowpnpm test— not re-run for this commit; see belowtargeted tests:
npx vitest run --project lynx— 48 files, 730 passed.Red-verified. Broke the record-map route so it drops row 0's
remove; thetest failed with the expected mismatch; restored. A test nobody has watched
fail is not protecting anything — and this one had already proved that once.
pnpm typecheck:fileson both changed files reports 40 errors inhost-driver.test.ts. All 40 are pre-existing: stashed the diff, re-ran,got 40;
diffof the two sorted error multisets is empty. No new errors.pnpm sync— clean (regeneratedAGENTS.md, context budget check passed).pnpm test(repo-wide) was run on the parent commit (perf(lynx): stop describing unbinds a teardown's own destroy subsumes #245) and produced 3failures, all three proven pre-existing there by reverting src to base
8938c1260and reproducing each in isolation. This commit touches the sametwo files plus a changeset, so that finding carries; the lynx project suite is
the meaningful gate and it is green.
Risk / follow-ups
stands. This closes the Order 3 verdict; it neither reorders the train nor
adds an Order.
previously said that the deletion recovering Order 3's +31.64 MB was "the
obvious inference", pending a gate-cell run. That run has happened
(#230),
against the campaign's own CDP instrument, n=4 per arm interleaved in one
window:
heapMtsAfterClear@10kmoves 10.23 → 10.21 MiB. The ranges aredisjoint so the movement is real, and it is 20 KB — three orders of
magnitude short of 31.64 MB. A retained peak and a post-collection reading are
different quantities; the mirror is released at the next batch either way, so a
forced GC after the clear was never going to find it, whatever it cost while
live. This PR stands on the three cost measurements above and on the removed
refusal condition. It does not deliver a retention win, and Clear/teardown pays 2.6–4× the peers' JS volume, regime-invariant, family-wide — attribute and shrink it (E2's cost half) #241's retention
oracle stays open.
destroy-runfollowinga declined compact now expands through the record map in a case where it
previously expanded through the mirror. test(lynx): pin the destroy-run mirror against the record-map fallback #243's differential is exactly the
test that says those two produce the same teardown, which is why that test had
to be repaired rather than deleted along with the mirror.
off
new-lynx, deliberately — both touchhost-driver.ts, and the standingrule is that the later change yields to the earlier. Verified separately that
test(lynx): pin the destroy-run mirror against the record-map fallback #243 and perf(lynx): stop describing unbinds a teardown's own destroy subsumes #245 both merge cleanly into
new-lynxand that a trial merge keepsstages/evidence.test.mjsgreen (3/3). 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