Skip to content

perf: measure the second create and its teardown in the lynx-table gate - #235

Merged
Huxpro merged 1 commit into
new-lynxfrom
perf/lynx-create-residual-e1
Aug 30, 2026
Merged

Huxpro merged 1 commit into
new-lynxfrom
perf/lynx-create-residual-e1

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

#230 Order 3, the attribution half. This adds the instrument the split needed and
reports what it found; no product code changes.

Every op in the deterministic wire-cost gate measures a first create on a virgin
root. No cross-framework harness measures create that way past its first repetition:
the web runner rebuilds a case's pre-state before each sample
(RESET_EACH_SAMPLE in packages/runner/src/harness-web.mjs), so repetition 2 onward
creates over whatever the previous clear left behind. A path available only to a virgin
container therefore reads as fast in this suite and slow in that one, and nothing here
could tell the two apart. That is exactly the shape of the ~728 ms create residual at
10k.

clear and recreate are added to runTable, last and in that order, so every op
above them keeps measuring the tree the first create built. Both carry the same
one-command gate the first create does — retiring a run names the run, not its rows,
and mounting the replacement is the same single template-run command the first mount
was. Both hold, at 1k and 10k.

What the command counts cannot see is how much of that one command the receiver
expands back into per-host work, so meta.rows_*.warmCycle records it beside the
create/recreate prepare split.

What it found

rows clear.synthesizedCommands clear.denseValidate create prepare recreate prepare
1,000 10,000 0 ms 14.8 ms 16.1 ms
10,000 100,000 0 ms 156.8 ms 293.5 ms

A certified teardown consumes the destroy-run whole and synthesizes nothing. The
expansion fallback rebuilds one remove, one destroy and one listener detach per host
out of accepted state — the ten commands per row above. The zero beside it is the
proof: the certified path times its validation in denseValidate, so zero means it was
never attempted and the destroy-run went to expandRecordsRunTeardown.

Root cause, from a temporary probe at the two decision sites (reverted, not in this
diff): the app negotiates compactAck: 1 and lazyPublicInstances: 1, and its create
commit still reaches prepareLynxHostBatch with { announcesPublicInstances: true }
and nothing else. deferPublicInstances and incrementalCompactRequested
(core/transport.ts) both hang off postFirstTreeLazyPublicInstances, which is only
ever set inside the first-tree adoption handoff; the main thread's
record.postFirstTreeUpgrade is symmetric, set only in activateFirstTreeCapabilities.
A root that paints no first screen never reaches either, so no commit after its first is
compact, no teardownMirrorCandidate is accepted, and every clear takes the fallback.

Full attribution, including a candidate fix that failed and what its failure proved
about state.compactHosts, is on #230.

Left deliberately un-gated: synthesizedCommands and the prepare split. The receiver is
paying them today, and landing a knowingly-red gate would be worse than recording the
number where a fix has to move it.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test
  • targeted:
    • node benchmarks/bench.mjs --only lynx-table --ratios — PASS, 30/402 guards
      checked (was 26 before this diff).
    • Red-verified: feeding the guards commands + synthesizedCommands and
      commands + createdElements breaches all four at 10001x / 7001x / 100001x /
      70001x and exits 1. Restored.
    • LYNX_TABLE_SCALES=1000,10000 node run.mjs 1 at both scales.
    • pnpm format:files on every changed file, and pnpm sync (no generated changes).

benchmarks/lynx-table/workload.ts belongs to no TypeScript project — typecheck:files
declines it — so the Vite build inside run.mjs is its only typecheck, and it builds.

Risk / follow-ups

  • Benchmark-only diff, so no changeset.
  • node --test benchmarks/lynx-table/stages/*.test.mjs has one pre-existing failure
    on the merged base 8938c1260, unrelated to this diff and reproduced with the
    worktree stashed: stages/results/issue57-clear-teardown.json is no longer
    byte-identical to what writeEvidenceJson produces — the record predates the heap
    and wire blocks the writer now emits. Worth a separate refresh; I did not touch it
    here.
  • The gate now runs two more ops per scale, so run.mjs is slightly longer at 10k.
  • Repository CI run feat(monaco-editor): add Octane binding octanejs/octane#441 on new-lynx @ 8938c1260 has been queued since 03:06:39Z and
    never started, so this branch's base has no repository CI evidence of its own.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

Every op in the deterministic wire-cost gate measures a first create on a
virgin root. No cross-framework harness measures create that way past its
first repetition: the web runner rebuilds a case's pre-state before each
sample, so repetition 2 onward creates over whatever the previous clear left
behind. A path available only to a virgin container therefore reads as fast
here and slow there, and nothing in this suite could tell the two apart.

Add `clear` and `recreate` to `runTable`, last and in that order so every op
above them keeps measuring the tree the first create built. Both carry the
same one-command gate the first create does: retiring a run names the run,
not its rows, and mounting the replacement is the same single template-run
command the first mount was. Both hold at 1k and 10k.

What the command counts cannot see is how much of that one command the
receiver expands back into per-host work, so `meta.rows_*.warmCycle` records
it beside the create/recreate prepare split. Today the clear synthesizes ten
commands per row — 100,000 at 10k — with `denseValidate` at zero, which says
the certified teardown was never attempted and the `destroy-run` went to the
expansion fallback. Those stay informational rather than gated because the
receiver is paying them now; issue #230 carries the attribution.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant