Skip to content

perf(lynx): take first-tree capture off the first-paint path - #56

Draft
Huxpro wants to merge 17 commits into
mainfrom
claude/lynx-first-screen-capture-perf
Draft

Huxpro wants to merge 17 commits into
mainfrom
claude/lynx-first-screen-capture-perf

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

Capturing the Lynx first tree runs after the page is already published to the
host, so everything it does sits between the tree reaching the DOM and the
browser painting it. Measured at the Element PAPI boundary, that window is
16.7–20.1% of FCP at 1k/10k/30k rows, scaling linearly at ~0.029 ms/row.

Two commits take work out of it without changing behaviour.

1. Skip prop-patch planning for hosts that own nothing on the main thread.
Capture re-plans every painted host's props only to recover what the main thread
should own: a main-thread: event handler or main-thread:ref. Both are the
only ways to declare it and both carry that prefix, so a host without one is
answerable by a prop-name test rather than a full patch plan — and the props
themselves were already planned and applied when the tree was built. The
surrounding checks are untouched, including the one that matters when planning
is skipped: a host that never asked for main-thread ownership must still have
none mounted.

2. Describe the first tree after the paint, not before it. Most of the
window is not validation but allocation — turning the captured tree into the
clone-safe description the background clones when it adopts. Nothing before
adoption reads it, so it now builds on first read. Capture splits along
validation-versus-allocation rather than eager-versus-lazy, which is what keeps
the contracts intact:

  • eager — structural validation and the native-ID read, because a host that
    cannot be captured must still fault the synchronous first screen while its
    caller holds the source to retry cleanup against; plus the event token map,
    because a tap on the painted tree resolves through it long before adoption;
  • deferred — the description, which reads only record fields that teardown
    retains, so firstScreenSnapshot() still answers while unmount cleanup
    retries.

Measurements

Both from the host-side Element PAPI probe (an Object.assign interception at
the Web Core boundary, so it observes the host rather than the framework).
10,000-row first screen, 4× Intel Xeon @ 2.10GHz, Chromium 141.0.7390.37,
@lynx-js/web-core 0.22.2.

Commit 2, paired A/B with both bundles built side by side and alternating order,
n=8:

base with change paired median
post-publication window 217 ms 163 ms −54 ms, 8/8 pairs improved
FCP@10k 1,576 ms 1,483 ms −85 ms (−5.4%), 7/8 improved

Commit 1 is smaller and honestly stated as such: in that first screen no host
declares a main-thread: prop, so all 70,041 skip planning and the planning
cost falls from a 58.3 ms median to 28.8 ms — but end to end that is ~1.7%,
below what the harness resolves on this host, so no wall-clock claim is made
for it.

The measurement harness itself is not in this PR. It lives on a separate branch
(claude/issue-50-39v4y1, #52) under benchmarks/lynx-table/;
reproducing these numbers needs it, reviewing this diff does not.

Validation

  • packages/lynx suite: 340/340 on this branch.
  • pnpm typecheck:files on the three changed sources.
  • pnpm format:files:check packages/lynx .changeset.
  • Deliberate-break checks. Forcing commit 1's precondition to always
    report "no main-thread prop" turns host-driver.test.ts > transfers a compatible first tree without allocating or restructuring native nodes
    red. Corrupting commit 2's description turns 14 tests red across
    first-screen, host-driver, and milestone-8-integration — so both
    read orders, first read at adoption and first read from the public
    accessor before it, are already covered.

Risk / follow-ups

  • Both commits touch first-screen capture in packages/lynx core. Behaviour is
    meant to be identical. Commit 1's precondition is exact because
    main-thread:ref and parseLynxMainThreadEventProp both require that prefix
    and nothing else declares main-thread ownership. Commit 2's deferred
    description reads only record fields teardown retains.
  • The browser suites — including
    rspeedy-plugin-octane/tests/browser/web-host.test.ts, the Lynx Web host
    smoke test — could not run in the sandbox these were developed in (its
    Chromium build does not match the pinned Playwright one), so neither commit
    has been exercised against them. CI is the first place that happens. The
    benchmark harness does drive the real web host end-to-end in Chromium and its
    row-count predicates passed throughout.
  • Still unclaimed in that window: __FlushElementTree publication itself owns
    ~27% of the first-screen excess over Octane's own post-mount path, and the
    remainder is framework first-screen script plus the browser's own frame after
    publication. Splitting that needs a framework-side probe on the first-screen
    path.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

trueadm and others added 12 commits August 12, 2026 20:14
…tanejs#738)

PR octanejs#727 made streaming SSR ship Float stylesheet resources discovered after
the shell with their boundary's reveal wave, closing the gap octanejs#725 had
deferred three ReactDOMFloat-test.js ledger cases against. Flip those cases
(:1923 …7b6da8a5, :2041 …8d52f5f3, :2350 …745930fa) to covered with evidence
into the 'streamed late boundaries' describe, add one adapted test for the
:2350 inline-flush shape (inner boundary resolves first; its complete content
and sheet ride the parent's reveal wave exactly once), and regenerate the
coverage report. ReactDOMFloat planned drops 8 -> 5.

Co-authored-by: Claude Fable 5 <[email protected]>
…ounts (octanejs#739)

* fix: form Float precedence groups in tree discovery order on client mounts

Precedence group order is CSS cascade order. Client mounts created groups in
body-completion order, so a nested child's or @Try arm's group could precede
its parent's and the same tree cascaded differently on a client-only mount
than on an SSR'd page. Resource registrations now run after a component's
setup but before its constructs mount children, forming groups parent-first
with suspended arms at reveal — matching SSR and React.

The server twin fixes a latent TDZ crash the placement rule exposed: a hoisted
head element or Float resource whose attribute reads a setup local emitted its
registration ahead of the local's declaration and threw at render. Capture-free
head statements keep the historical front placement (arm-root sheets still
ship with the streaming shell); capturing ones now run right after setup,
still ahead of the children the return renders.

Adjudicates the client group-order item from octanejs#711 as "fix".

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix: keep server head-statement order across the capture partition

Registration order is precedence-group order, so the capture split must not
reorder the list: a capture-free head statement after a capturing one used to
jump to the body front, cascading differently on SSR than on a client mount.
Only the capture-free prefix leads now; from the first capturing statement on,
everything defers together in source order. (Bugbot review finding.)

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
…meout errors (octanejs#740)

The markdown conformance public-api probe imports src/index inside the
test body, so the package's first Octane compile counted against
vitest's 5s default testTimeout and intermittently lost the race under
the 136-lane parity batch. The markdown project now carries the repo's
30s compile-heavy timeout convention.

The batch also reported such timeouts as 'Error: STACK_TRACE_ERROR'
because vitest's JSON reporter serializes error.stack alone while
makeTimeoutError keeps the real message only on error.message. A thin
JsonReporter subclass re-embeds the message into the stack before
serialization, wired into the parity batch, the harness single-lane
vitest runners, and the unhandled reporter.

Co-authored-by: Claude Fable 5 <[email protected]>
)

CSSTransitionAnimate imported `AnimationController` from './AnimationController',
which does not exist. Upstream ships that module as types-only, so its compiled
JavaScript is `export {}` and the vendoring pass, which copies compiled es6
output, dropped it. AnimationHandle is reconstructed from the real
JavascriptAnimation and CSSTransitionAnimation classes.

The same file imported `CSSProperties` from `octane`, which does not export it.
The style type now derives from octane's own JSX surface, so this needs no
`react` dependency the package does not have.

Package diagnostics under tsrx-tsc go from 1268 to 1266. The remaining
`./easing` errors in this file are downstream of easing.js being untyped and
are tracked separately.
* fix(bindings): validate strict packed TSRX consumers (octanejs#721)

* fix(recharts): expose strict consumer types (octanejs#726)

* fix(recharts): align public type exports (octanejs#730)

* test(packages): enforce strict TSRX source consumers (octanejs#721)

* Address PR review feedback (octanejs#733)

- install the complete packed workspace dependency closure
- allow pnpm to install required external peers

* Clarify deferred strict binding coverage (octanejs#733)

- defer Recharts source compilation until tsrx-tsc resolves extensionless TSRX imports

* Address PR review feedback (octanejs#733)

- keep precise API probe packages installed when source validation is deferred

* Fix packed TSRX consumer dependency graph

---------

Co-authored-by: Dominic Gannaway <[email protected]>
The upstream-root suite's focus/reconnect case intermittently lost the
focus revalidation (fetcher called 2 of 3 times). The mount effect arms
the focus throttle at Date.now() + focusThrottleInterval and a focus
event revalidates only at a strictly later timestamp, so even at
interval 0 a focus whose setTimeout-deferred adapter callback lands in
the mount millisecond is throttled. This is pinned upstream SWR 2.4.2
behavior (its suite sleeps a real 1ms before focusing), so the test now
controls the clock instead: fake only Date and step it past the armed
throttle before dispatching focus, leaving real timers to drive the
environment adapters' deferred callbacks.

Co-authored-by: Claude Fable 5 <[email protected]>
…ctanejs#734)

* fix: validate published TSRX source with a consumer-shaped typecheck

Packages that ship .tsrx were typechecked by tsgo, which drops those
files from the program entirely. Their published source was therefore
never checked at all. Bindings publish raw source and point exports at
it, so every one of those errors is visible to a consumer.

- Generate canonical consumer projects from the same tsconfig the CLI
  scaffolds, with a drift check, so what is validated cannot diverge
  from what users actually compile against.
- Move the .tsrx-publishing projects that already pass onto tsrx-tsc.
- Add a no-@types/node lane to the packed-tarball canary. The existing
  lane sets types: ["node"], so it cannot see `process` references in
  published source, which a browser app does not resolve.
- Add a guardrail over source-published packages with an enumerated
  allowlist of the remaining violations. A stale entry fails the check,
  so the list can only shrink.

* refactor: cede packed-canary changes to octanejs#733

octanejs#733 rebuilds the packed TSRX consumer canary around automatic discovery
of every binding that ships .tsrx, which is a better answer than the
package list this branch was extending. Drop the overlapping edits to
package-pack-canaries.mjs, check-package-packs.mjs and their test so the
two branches stop touching the same files.

What remains here is the part octanejs#733 does not cover: the root typecheck
chain still runs tsgo over packages that ship .tsrx, so those files are
absent from the program CI actually runs.

* fix(bindings): fix published source a browser app cannot type-check

These packages ship raw source and point exports at it, so a consumer's
program compiles every reachable module. The repo checked them with tsgo,
which drops .tsrx from the program, so none of this was visible in CI
while all of it was visible to consumers.

- Declare `process` module-locally at every published
  `process.env.NODE_ENV` reference. A browser app has no @types/node. The
  expression stays written out literally so bundler define substitution
  and the dead-code elimination after it are unaffected, and nothing
  ambient ships in the tarball.
- Let Form and Link accept a null forwarded ref: the compiler composes it
  as ref={[ref, spread.ref]}, and Ref<T> array members cannot be undefined.
- Carry the same process deviation into the remix-router vendoring script,
  so a re-vendor does not reintroduce the error.

The Provider prop typings for jotai and redux are left to octanejs#733, which
edits the same two files.

* fix: widen the source-publication gate past the typecheck chain

Two defects Cursor Bugbot found on this PR, both confirmed.

The nodeTypes and excluded rules only saw projects discovered by parsing
inline compiler invocations out of the root typecheck chain. A package
validated through a package script, a node wrapper, or absent from the
chain never entered the loop, so the gate stayed green while missing the
defect it claims to block. They now walk each source-published package's
own tsconfigs; the tsgo rule still follows the chain, since that rule
genuinely is a claim about what the chain runs.

The excluded rule matched an exclude entry only when it named a shipped
file exactly, so `src`, `src/**` or `src/**/*.tsrx` could drop packed
source without tripping it. Exclude entries are now translated into path
predicates following tsc's own wildcard shape.

The allowlist grows from 100 to 112. All twelve additions are
node-types-in-validation-tsconfig entries that chain-only discovery could
not see, including the four Bugbot named. The previous number was not the
real debt, only the part the gate could reach.

* fix: stop the spec matcher spanning directories on a wildcard segment

Third Bugbot finding, confirmed. The trailing `($|/)` was appended to every
pattern, so a wildcard final segment behaved like a directory prefix:
`src/*` matched `src/a/b/deep.ts` and `*` matched `src/a/b.ts`, where tsc's
`*` and `?` do not cross `/`.

Only a literal final segment, or `**` whose `.*` already spans, keeps the
directory suffix now. Totals are unchanged at 112; no current entry depended
on the over-match.
…n and head priority order (octanejs#742)

* fix: close the last Float engine gaps — fallback-hoistable suppression and head priority order

Fallback hoistables are now suppressed transitively on the server: a
title/meta/link authored inside a pending boundary's fallback never reaches
the streamed head, including from a completed boundary nested inside that
fallback — the fallback is discarded at reveal, but a streamed head line is
permanent. Float resources and hints from fallbacks stay registered
(page-global; React allows fallback preloads).

Priority hoistables now lead the server head fold: meta charSet first
(parsers only honor a charset within the first 1024 bytes), then
meta name="viewport", then everything else in discovery order — Fizz parity.
The new HeadBuffer buckets join both suspense-replay snapshot/rewind sites.

Also flips the final actionable evidence cases: identifierPrefix root option,
the three external-store compatibility cases, and the two engine-gap cases
above. ReactDOMFloat-test.js planned drops to 3 (warning families only);
whole-ledger planned 1,928 -> 1,922.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix: carry the fallback hoist depth through the ambient snapshot

FALLBACK_HOIST_DEPTH is balanced by withPendingArm's finally within every
synchronous pass, so no interleave point can observe a non-zero value today —
but Ambient's contract is that EVERYTHING a pass touches is saved and
restored, and an unsaved global is a landmine for any future pass that yields
mid-arm. (Bugbot review finding.)

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
…ejs#743)

pnpm typecheck:files failed on any edited swr test file (untyped devtools
Window globals, untyped .tsrx fixture props, Middleware/Cache contract
violations) while repo-wide typecheck never checks packages/swr/tests. Add a
tests-scoped tsconfig + tests-local Window d.ts (nothing ships: the tarball is
src-only), give the differential lane its own tsconfig so the ambient
augmentation cannot un-use the vendored upstream's @ts-expect-error, add
types:["node"] to the tsgo-checked conditions lanes, and fix the test-side
type errors within public contracts.

Co-authored-by: Claude Fable 5 <[email protected]>
…nejs#745)

One component may split its scoped CSS across several <style> blocks —
compile.js rebases every sheet onto the first block's canonical hash, and
tests/_fixtures/return-style.tsrx proves it through mount, SSR, and
hydration. @tsrx/core's shared type-only JSX transform instead threw "TSRX
fragments can only have one style tag", and tsrx-tsc's fallback then
presented the raw source as the virtual TSX, so every CSS brace surfaced as
TS1381/TS1005 parse errors and the syntactic abort hid the rest of the
program's diagnostics.

Patch @tsrx/core 0.1.56 (pnpm patch) so the TYPE-ONLY path accepts multiple
sheets and rebases them onto the first sheet's hash; runtime transforms keep
the throw, so @tsrx/react's differential compile is unchanged. Add a volar
regression test that fails with the original throw on unpatched core, type
the fixture's props param, and stop the typecheck-files walker from
descending into hidden directories (the differential rig's .react-cache
compiled output was entering sweeps as JS roots and flipping allowJs).

Co-authored-by: Claude Fable 5 <[email protected]>
…nership

First-tree capture re-plans every painted host's props, but only to recover
what the main thread should own: a `main-thread:` event handler or
`main-thread:ref`. Those are the only two ways to declare it and both carry
the `main-thread:` prefix, so a host without one can be answered by a
prop-name test rather than a full patch plan. The props themselves were
already planned and applied when the tree was built; this call rediscovers
nothing else.

The surrounding checks are unchanged, including the one that matters when the
plan is skipped: a host that never asked for main-thread ownership must still
have none mounted.

This sits on the first-paint path. Capture runs after the page is published to
the host, so every millisecond it spends is paint delay — the host-boundary
instrument in benchmarks/lynx-table measures that window at 16.7-20.1% of FCP
across 1k/10k/30k rows. In the benchmark's 10,000-row first screen no host
declares a `main-thread:` prop, so all 70,041 skip planning and the
capture-time planning cost falls from a 58.3 ms median to 28.8 ms on the same
instrument. End to end that is about 1.7% of first paint, below what the
harness resolves on a 4-CPU host, so no wall-clock claim is made for it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UMisRkW6cGfodXwpy4kxYS
Capturing the first tree runs after the page is already published to the
host, so everything it does sits between the tree reaching the DOM and the
browser painting it. The host-boundary instrument measures that window at
16.7-20.1% of FCP across 1k/10k/30k rows.

Most of it is not validation, it is allocation: turning the captured tree
into the clone-safe description the background clones when it adopts. Nothing
before adoption reads that description, so it now builds on first read.

What stays eager is what the contracts need:

- validation and the native-ID read, because a host that cannot be captured
  has to fault the synchronous first screen while its caller still holds the
  source to retry cleanup against; and
- the event token map, because a tap on the painted tree resolves through it
  long before the background adopts.

The description therefore reads only retained record fields, which is why
`firstScreenSnapshot()` still answers while unmount cleanup retries rather
than describing a container mid-teardown.

Measured on the lynx-table 10,000-row first screen, paired A/B with both
bundles built side by side and alternating order, n=8: the post-publication
window falls from a 217 ms median to 163 ms with every pair improving, and
FCP@10k from 1,576 ms to 1,483 ms (paired median -85 ms).

Deliberately breaking the description turns 14 tests red across
first-screen, host-driver, and milestone-8-integration, so both read orders —
first read at adoption, and first read from the public accessor before it —
are already covered.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UMisRkW6cGfodXwpy4kxYS
Huxpro and others added 5 commits August 13, 2026 15:39
…ation (octanejs#748)

* perf: bound the Element PAPI floor for per-row main-thread materialization

Add a speed-of-light probe that materializes the exact 10,000-row table
shape with a bare public Element PAPI loop in the same main-thread realm
as the Lynx receiver, interleaved AB/BA with octane control/profile
create cells, and record the measured floor:

- papi_element_creation is 99.0% platform floor (collapsible 0.5% of
  the create wall)
- mt_apply_other is 84.7% floor-equivalent (collapsible 4.6%)
- chunked vs single flush makes no difference

All three sub-owner candidates from the roadmap fail the >=10% owner
gate for per-element MTS machinery on the web harness.

* fix(bench): isolate Lynx create profile samples

---------

Co-authored-by: Dominic Gannaway <[email protected]>
…ejs#749)

* perf: bound the Element PAPI floor for per-row main-thread materialization

Add a speed-of-light probe that materializes the exact 10,000-row table
shape with a bare public Element PAPI loop in the same main-thread realm
as the Lynx receiver, interleaved AB/BA with octane control/profile
create cells, and record the measured floor:

- papi_element_creation is 99.0% platform floor (collapsible 0.5% of
  the create wall)
- mt_apply_other is 84.7% floor-equivalent (collapsible 4.6%)
- chunked vs single flush makes no difference

All three sub-owner candidates from the roadmap fail the >=10% owner
gate for per-element MTS machinery on the web harness.

* perf: re-arm compact acknowledgements after certified teardown

A compact first mount could only engage once per root: the main thread
kept implicitInitialGenerations set forever and the background client
refused further compact acknowledgements while retired segment metadata
existed, so every create after a clear republished a full per-host
handle delta - 17.4 MB of reverse traffic, ~600 ms of main-thread wall,
and eager background materialization of all 70k handle entries on the
shared 10k-row table. The public benchmark's warmed-page protocol
measures exactly this path.

- reset implicit generation bookkeeping when a certified dense teardown
  leaves every surviving record's generation stored
- gate compact eligibility on a fresh-id ratchet (maxExplicitId) so
  implicit generation-one segments can never cover a reused id and
  remounts keep bumping generations on the explicit path
- retire background compact metadata when its last live host code is
  removed, restoring it on rollback

Create-after-clear acknowledgement: 17,330,831 B -> 719 B; warmed-page
create@10k wall median 2,028 -> 1,511 ms on the same host with fresh
cells unchanged. Adds bts-profile.mjs (background/page attribution with
wire deltas, fresh vs warmed-protocol cells) and its measured results.

---------

Co-authored-by: Dominic Gannaway <[email protected]>
…ctanejs#732)

* fix: validate published TSRX source with a consumer-shaped typecheck

Packages that ship .tsrx were typechecked by tsgo, which drops those
files from the program entirely. Their published source was therefore
never checked at all. Bindings publish raw source and point exports at
it, so every one of those errors is visible to a consumer.

- Generate canonical consumer projects from the same tsconfig the CLI
  scaffolds, with a drift check, so what is validated cannot diverge
  from what users actually compile against.
- Move the .tsrx-publishing projects that already pass onto tsrx-tsc.
- Add a no-@types/node lane to the packed-tarball canary. The existing
  lane sets types: ["node"], so it cannot see `process` references in
  published source, which a browser app does not resolve.
- Add a guardrail over source-published packages with an enumerated
  allowlist of the remaining violations. A stale entry fails the check,
  so the list can only shrink.

* refactor: cede packed-canary changes to octanejs#733

octanejs#733 rebuilds the packed TSRX consumer canary around automatic discovery
of every binding that ships .tsrx, which is a better answer than the
package list this branch was extending. Drop the overlapping edits to
package-pack-canaries.mjs, check-package-packs.mjs and their test so the
two branches stop touching the same files.

What remains here is the part octanejs#733 does not cover: the root typecheck
chain still runs tsgo over packages that ship .tsrx, so those files are
absent from the program CI actually runs.

* fix: widen the source-publication gate past the typecheck chain

Two defects Cursor Bugbot found on this PR, both confirmed.

The nodeTypes and excluded rules only saw projects discovered by parsing
inline compiler invocations out of the root typecheck chain. A package
validated through a package script, a node wrapper, or absent from the
chain never entered the loop, so the gate stayed green while missing the
defect it claims to block. They now walk each source-published package's
own tsconfigs; the tsgo rule still follows the chain, since that rule
genuinely is a claim about what the chain runs.

The excluded rule matched an exclude entry only when it named a shipped
file exactly, so `src`, `src/**` or `src/**/*.tsrx` could drop packed
source without tripping it. Exclude entries are now translated into path
predicates following tsc's own wildcard shape.

The allowlist grows from 100 to 112. All twelve additions are
node-types-in-validation-tsconfig entries that chain-only discovery could
not see, including the four Bugbot named. The previous number was not the
real debt, only the part the gate could reach.

* fix: stop the spec matcher spanning directories on a wildcard segment

Third Bugbot finding, confirmed. The trailing `($|/)` was appended to every
pattern, so a wildcard final segment behaved like a directory prefix:
`src/*` matched `src/a/b/deep.ts` and `*` matched `src/a/b.ts`, where tsc's
`*` and `?` do not cross `/`.

Only a literal final segment, or `**` whose `.*` already spans, keeps the
directory suffix now. Totals are unchanged at 112; no current entry depended
on the over-match.

* fix: deny the consumer projects the Node globals a browser app lacks

Fourth Bugbot finding, confirmed. The generated projects omitted `types` to
mirror `octane init`, but the two omissions mean opposite things. A freshly
scaffolded app has no `@types/*` installed at all; these projects run inside
the monorepo, where an omitted `types` makes TypeScript auto-include every
installed one. Published source was being handed the Node globals it must
not see, which is the exact gap these projects exist to catch.

Proved before and after with a probe compiled under the base config inside
the repo: `process.env.NODE_ENV` resolved cleanly, and now reports TS2591.

The packed-tarball consumer already pins `types` empty for the same reason,
so this makes the in-repo projects agree with it.
…ctanejs#750)

* perf: bound the Element PAPI floor for per-row main-thread materialization

Add a speed-of-light probe that materializes the exact 10,000-row table
shape with a bare public Element PAPI loop in the same main-thread realm
as the Lynx receiver, interleaved AB/BA with octane control/profile
create cells, and record the measured floor:

- papi_element_creation is 99.0% platform floor (collapsible 0.5% of
  the create wall)
- mt_apply_other is 84.7% floor-equivalent (collapsible 4.6%)
- chunked vs single flush makes no difference

All three sub-owner candidates from the roadmap fail the >=10% owner
gate for per-element MTS machinery on the web harness.

* perf: re-arm compact acknowledgements after certified teardown

A compact first mount could only engage once per root: the main thread
kept implicitInitialGenerations set forever and the background client
refused further compact acknowledgements while retired segment metadata
existed, so every create after a clear republished a full per-host
handle delta - 17.4 MB of reverse traffic, ~600 ms of main-thread wall,
and eager background materialization of all 70k handle entries on the
shared 10k-row table. The public benchmark's warmed-page protocol
measures exactly this path.

- reset implicit generation bookkeeping when a certified dense teardown
  leaves every surviving record's generation stored
- gate compact eligibility on a fresh-id ratchet (maxExplicitId) so
  implicit generation-one segments can never cover a reused id and
  remounts keep bumping generations on the explicit path
- retire background compact metadata when its last live host code is
  removed, restoring it on rollback

Create-after-clear acknowledgement: 17,330,831 B -> 719 B; warmed-page
create@10k wall median 2,028 -> 1,511 ms on the same host with fresh
cells unchanged. Adds bts-profile.mjs (background/page attribution with
wire deltas, fresh vs warmed-protocol cells) and its measured results.

* perf: tear down removed collapsed runs with one destroy-run command

Clearing a 10k-row keyed table shipped a 100,000-command teardown stream
(3.5 MB), acknowledged it with 70,000 tombstone deltas (2.9 MB), expanded
every removed collapsed row into seven logical records just to enumerate
those commands, and grew both threads' generation tables by 70,000
entries per cycle.

The universal renderer now advertises a teardownRuns driver capability:
a removed subtree that is still a collapsed program-run instance with
implicit contiguous ids skips expansion and contributes to one
destroy-run command per contiguous range. The Lynx binding negotiates
the capability, re-enters the certified teardown fast path by expanding
the command against its dense record store (with an accepted-records
fallback and a general-loop path for partial ranges), acknowledges a
full-run teardown with a single remove-run delta, and records one
sorted retired-range tombstone per side instead of 70,000 map entries.

Clear command stream 3,514,556 B -> ~370 B; clear acknowledgement
2,929,786 B -> ~813 B; compact create acknowledgements survive the
cycle. Reused ranges keep bumping generations; emitter-, host-, and
client-side regression tests were observed red before the change.

* fix(lynx): honor retired run generations

---------

Co-authored-by: Leonidas <[email protected]>
Co-authored-by: Dominic Gannaway <[email protected]>
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.

4 participants