Repository navigation
perf: re-arm compact acknowledgements after certified teardown - #749
Merged
Merged
Conversation
…ation 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.
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.
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
so a create after a clear publishes a few hundred bytes instead of a full
per-host handle delta (17,330,831 B → 719 B on the shared 10k-row table)
every surviving record's generation stored; gate compact eligibility on a
fresh-id ratchet (
maxExplicitId) so implicit generation-one segments cannever cover a reused id; retire background compact metadata when its last
live host code is removed (restored on rollback)
benchmarks/lynx-table/stages/bts-profile.mjs: background/page-realmattribution with per-op wire deltas, fresh-page vs featured-warmed-protocol
cells, plus its measured results
Why
Roadmap item 2 of Huxpro#51. Owner-first measurement (bts-profile, n=5,
AB interleaved) showed the featured benchmark's warmed-page protocol pays a
re-publication cliff octane's fresh-page numbers never see: every create after
a clear shipped 17.2–17.4 MB of
dispatchCoreContextOnBackgroundtraffic(70k ×
{op:'create', handle}deltas), eagerly materialized 70k backgroundhandle entries, and added ~600 ms of main-thread wall. Mechanism: compact
acknowledgements could only engage once per root —
implicitInitialGenerationsratcheted on forever, and the background client refused further compact ACKs
while retired segment metadata existed — so the steady state the public
ranking measures ran permanently on the worst path.
Measured effect (same host, public runner protocol, AB and BA orders, n=7)
† The clear cell is a measurement-boundary transfer, not a product regression:
the public runner clicks the timed clear immediately after its setup create
without settling, and with the fix the create predicate fires before the
browser's one-shot layout pass instead of after it (the 17 MB acknowledgement
serialization used to keep the main thread busy past layout). Draining the
setup debt with one settle makes the cells identical — baseline 701.1 ± 60.6 ms
vs fix 694.1 ± 19.9 ms (n=7, same window) — and the create+clear cycle
total improves ~8% in both orders either way. The same effect accounts for the
small swap/remove ratio shifts (±1–4 ms absolute on ~20 ms cells). Storms,
select, update10th latency, and both heap cells are unchanged; wire
create-bytes/row crown is unchanged (fresh create still publishes ~1 KB).
A dedicated n=15 startup probe (stock runner, one window) resolves the n=5
startup readings as noise: fcp deltas are +0.7% / +0.6% / +1.2% / +2.1% at
0/1k/10k/30k rows — all under the 5% adverse gate; the startup path takes none
of the changed branches (no teardown, no compact metadata at boot).
Invariants preserved
keep bumping generations — pinned by the new host-driver regression test and
the existing
retires a complete compact run…test.and keeps refusing new compact ACKs — pinned by the new client-side test.
packages/lynx suite green (344 tests).
Validation
npx vitest run packages/lynx/tests/— 344 passedtsc --noEmitclean relative to base (one pre-existingunrelated error in
main-thread.tsexists on base and head alike)pnpm format:files:checkon changed files;pnpm synccleanacknowledgement 17,330,831 B → 719 B, rendered output identical
pnpm test(full repo): 20,673 passed / 54 failed / 194 skipped — everyfailure is in browser-integration projects that need the pinned Playwright
browsers, GPU, or unproxied networking this container lacks (three, pdf,
doom, draggable, plugin browser suites); zero failures under
packages/lynxor
packages/octaneRisk / follow-ups
eagerly and the clear command stream remains O(n) — roadmap item 3.
ensurePre('rows')does not settlebefore the timed sample, so setup rendering debt can land in whichever cell
runs next; a one-line settle equalizes it for every entry.
Provenance
agent-authored)🤖 Generated with Claude Code
Generated by Claude Code
Note
Medium Risk
Touches host/client generation and compact-ack bookkeeping on a hot create-after-clear path; behavior is heavily regression-tested but incorrect ratchet or teardown logic could break handle identity or stale-generation rejection.
Overview
Restores incremental compact handle acknowledgements after create/clear cycles so steady-state table creates no longer ship a full per-host delta (~17 MB → ~719 B on the 10k-row app).
On the host driver, certified dense teardown can clear
implicitInitialGenerationswhen every surviving record has an explicit generation; incremental compact runs must usefirstId > maxExplicitIdso reused id ranges stay on the explicit path with generation bumps;maxExplicitIdis maintained on accept/teardown/compact.On the background client, compact segment metadata tracks a
livehost count, drops the segment when the last compact code retires (with rollback restore), and no longer blocks a later compact ACK via the “fresh container” guard.Adds
bts-profile.mjs(CDP profiling of the Lynx background worker, fresh vs warmed harness protocol) plus sample 10k-row results, and regression tests for re-arm after teardown and client-side metadata retirement.Reviewed by Cursor Bugbot for commit ef6565b. Bugbot is set up for automated code reviews on this repo. Configure here.