Skip to content

bench(lynx-table): price the main-thread program cell on both harnesses - #181

Merged
Huxpro merged 1 commit into
new-lynxfrom
feat/lynx-mts-program-bench
Aug 26, 2026
Merged

Huxpro merged 1 commit into
new-lynxfrom
feat/lynx-mts-program-bench

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary

Issue #163 C4b. The octane-mts-program cell: the lynx-table application built
with the main-thread program backend, wired into both harnesses that can price
it, plus the README section and the committed records. This is the slice that
produces C4's numbers, and it reports one of #163's two update-band oracles met
and the first-screen oracle not met.

Why

C4a proved a program-painted page takes ordinary updates over the real
transport. It could not say what they cost. #163's oracle asks two separate
questions of C4 and this slice is where both get asked of the real application
rather than a fixture:

  1. First screen — block-core FCP within 5% of octane-direct at 1k/10k/30k.
  2. Updates — Lynx FCP to its ceiling: eliminate or attribute every first-screen millisecond (#58 / #135 campaign) #148's corollary: every update op's band overlaps today's or
    improves it.

Neither is answerable without a cell, and a cell is only worth trusting if the
two arms differ in exactly one thing. They do, and it is measured rather than
asserted: across the backend switch on this application the background chunk
is byte-identical
(285,413 bytes, sha256 9b5e9e5df496…) and the main-thread
chunk moves by 700 bytes (216,547 → 217,247). After adoption both cells run the
same background code over the same wire, which is what makes an update-band
difference between them a finding rather than a build artefact.

Results

Oracle 2 — update bands: met

Same window, n=7, cells interleaved AB/BA, medians in ms (prototype/results/web-c163-c4b-update-bands.*):

op 1k octane 1k +program 10k octane 10k +program
create 136 ±3 136 ±1 1124 ±21 1142 ±10
update10th 22 ±1 23 ±1 125 ±4 131 ±4
select 20 ±2 21 ±1 64 ±5 64 ±2
updateStorm 79 ±9 81 ±8 472 ±17 468 ±24
selectStorm 22 ±4 19 ±4 99 ±10 93 ±8
clear 63 ±2 61 ±2 548 ±8 546 ±16

All twelve bands overlap. Two are marginal and in the same direction an earlier
session saw — create (+1.6%) and update10th (+4.8%) at 10,000 rows — and
neither is explained; see follow-ups.

Oracle 1 — first screen: not met

Medians of n=7, fresh page per sample, AB/BA, same window per scale
(prototype/results/fcp-{1000,10000,30000}.*):

rows octane +program octane-direct +program ÷ direct gap to ceiling closed
1,000 219.3 183.1 133.5 1.37× 42%
10,000 1365.3 1113.6 901.8 1.23× 54%
30,000 4269.7 3313.5 2406.1 1.38× 51%

The oracle asks for 1.05×. The compiled first screen closes between 42% and 54%
of the distance from today's interpreted page to the hand-written L0 prototype,
and no more. That is a real and reproducible improvement — 16.5%, 18.4% and
22.4% off octane's own FCP at the three scales — and it is not the oracle.

octane-direct is not a cell Octane ships: it is this one page emitted by code
written for this one page, with nothing between the entry point and the PAPI. It
is the floor a compiled program aims at. What the residual 1.24–1.38× is made of
is the question C4b cannot answer and the next slice is scoped to: PAPI crossings
versus composition versus the publication floor, decomposed at the host boundary
by stages/papi-run.mjs.

The measurement this slice had to fix first

The FCP ladder's selector attrs column samples octane-ref after settle. For
an interpreted page that is the same as sampling at paint, because the
interpreter installs one selector per node on the way to the first frame. For a
program-painted page it is not: a compiled program installs none, and whatever
the adopting commit decides afterwards lands on top of that — so the settled
column can report the interpreted regime for a page the interpreter never
touched. At 1,000 rows it read 4,028 in three of seven otherwise identical
repetitions and 0 in the other four.

Rather than annotate that away, the ladder now samples the regime at the first
painted frame
, on its own pages after the timed reps so the timed path stays
byte-identical to every prior run on this ladder. Asked at that moment the
program cell is 1000/0, 10000/0 and 30000/0 in every repetition at every
scale, and octane is 1000/4028, 10000/40028, 30000/120028. The program
painted; the 4,028 lands after the first frame, cannot move FCP, and never
exceeds what octane has already paid before its own.

Two further controls back the numbers up:

  • This cell adopts; it does not repair. New prototype/adoption-probe.mjs
    tags every row element at the first painted frame and counts survivors four
    seconds later, because a repair builds different elements and would keep none.
    Both octane and octane-mts-program keep all of them at both scales
    measured — 1,000/1,000 and 10,000/10,000. FCP here is an adoption number and
    reads against octane's directly, which is exactly what the octane-block
    cell's does not.
  • ranges is not a probe for this build. On the small fixture
    ../lynx-bundle-size/core-switch.mjs compiles, searching the decoded
    main-thread script for a compiled program's ranges key separates the
    backends. On this application it does not:
    packages/lynx/src/core/main-renderer.ts ships its own runtime into both
    arms' main-thread chunk and carries the identifier with it. The first-frame
    selector regime is the probe that works here; the byte comparison is what says
    the backend switched at all.

Changes

  • benchmarks/lynx-table/app/lynx.config.mjs — BENCH_MTS_PROGRAM=1 hands the
    compiler the main-thread program backend and moves the dist path. Both the
    TypeScript-source hook and the backend import are dynamic and behind the flag,
    so a default build loads neither.
  • benchmarks/lynx-table/scripts/build-app.mjs — buildTableApp({ mtsProgram })
    and the matching dist suffix. Orthogonal to core, because it moves the other
    chunk.
  • benchmarks/lynx-table/web/run-web.mjs — the octane-mts-program cell, and
    the auto-build branch that produces its bundle.
  • benchmarks/lynx-table/prototype/run-fcp.mjs — the same cell on the FCP
    ladder, picked up automatically once its bundle exists, plus the first-frame
    regime sample described above.
  • benchmarks/lynx-table/README.md — the cell's section, in the shape the
    octane-block one uses: what it is, what makes the A/B honest, and the four
    things that must travel with any number from it.
  • benchmarks/lynx-table/prototype/results/fcp-{1000,10000,30000}.* — the
    committed records.
  • No changeset. No published package changes; this is benchmark harness,
    documentation and records.

Validation

Run on c4e791b6b:

  • pnpm sync — clean, no generated changes
  • pnpm typecheck — pass, zero error TS
  • vitest run --project octane --project octane-prod --project lynx —
    893 files, 13,172 tests, all passed (434 s)
  • node benchmarks/bench.mjs --only lynx-table --ratios — PASS, 26/303
    guards checked, no ratio guard breached
  • pnpm format:files:check on every changed file — clean
  • node benchmarks/lynx-bundle-size/core-switch.mjs — FAILS, see below
  • pnpm test (full) — not run; the three projects above are the ones this
    train touches
  • device cell — not run here; Main-thread-resident block programs: the optimal-Lynx first screen #163's oracle clause 4 stays unmeasured

The core-switch.mjs gate is red, and it is red at the base commit. It
exits 1 with universal carries a compiled program without a backend; the probe is not specific for both the universal and block arms. The cause is exactly the
ranges finding above: PROGRAM_PROBE = 'ranges' (core-switch.mjs:86) is
searched in the decoded main-thread script, and the Lynx main renderer now ships
its own runtime — containing that identifier — into every main-thread chunk,
so the probe no longer discriminates. This diff touches
benchmarks/lynx-table/** and nothing else (git diff --name-only outside that
directory is empty), so it cannot have caused it; a C2 slice did, when the main
renderer gained program-mount code.

#148's corollary requires these invariants to hold on every landed slice, so the
probe is being rewritten as the next slice rather than left. The sha256 column
the script already prints discriminates correctly today — universal and
block are both 24887887acc3, block+program is b478af615c53 — which is
the natural basis for a probe that means what its label says. #163's
byte-identity promise itself is intact and independently confirmed on the real
application here.

Risk / follow-ups

  • core-switch.mjs is red at base and its probe is being rewritten as the
    next slice. Details in Validation above.
  • Oracle clause 1 is not met — 1.24–1.38× against a ≤1.05× target. The
    attribution slice through stages/papi-run.mjs is what can say whether the
    remaining distance is reachable at all, and it starts next.
  • The 10k create (+1.6%) and update10th (+4.8%) medians are unexplained.
    Both overlap; the obvious mechanism is ruled out — after one create at 10,000
    rows both cells hold the same 28 nodes-ref selectors (shell 28,
    after-create 28, over 20,000 content nodes), so this is not per-node selector
    work carried over from adoption.
  • Which commit installs the 1,000-row selectors after the first frame, and why
    the same page decides differently at 1,000 and 10,000 rows, is open.
    The
    leading unproven explanation is that an adopting batch loses the lazy path:
    acceptedLazyPublicInstances (host-driver.ts:5081) requires
    firstTree === undefined, and the apply-time create at host-driver.ts:~6913
    falls back to bindNodesRefSelector without it. It cannot move FCP either way.
  • No cell from this build feeds §1's wire-cost gates, and none should. The
    wire is the background's, and the background chunk is the half that does not
    move.
  • mainThreadProgramBackend stays opt-in
    (packages/rspeedy-plugin-octane/src/plugin.js guards every use on
    !== undefined), so no product default changes with this slice.

Expectation management (restated per #157, as every C-report must)

Of the 11.5 s native create-1k, 10.52 s (91%) is host-driver interpreter
dispatch and bookkeeping
on LepusNG, which has no JIT. All 20,001 PAPI
crossings cost ~574 ms, of which the single __FlushElementTree is 431 ms —
larger than ReactLynx's entire 194 ms pipeline. DevTool adds 885 ms and stays
disabled in any device cell (#161). No C-slice claims ReactLynx parity. What
the C-train claims is the removal of the interpreter bucket; what remains after
it is what gets measured, and the native frontier then moves to #162.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

Issue #163 C4b. Adds `octane-mts-program` — the lynx-table application built
with the main-thread program backend — to the web wall-clock harness and the
FCP ladder, documents it in the README, and commits the records.

The two arms differ in exactly one thing, and it is measured rather than
asserted: across the backend switch the background chunk is byte-identical
(285,413 bytes, sha256 9b5e9e5df496...) and the main-thread chunk moves 700
bytes. After adoption both cells run the same background code over the same
wire, which is what makes everything the cell reports an A/B of the
first-screen encoding and nothing else.

#148's corollary holds: every update op's band overlaps its `octane` band in
the same window, at both scales, n=7. Two are marginal and in the same
direction as an earlier session, `create` and `update10th` at 10,000 rows, and
the mechanism that would have explained them is ruled out — both cells hold the
same 28 selectors after one create.

#163's first-screen oracle does not hold. The compiled program lands at
1.24-1.38x the hand-written `octane-direct` ceiling across 1k/10k/30k, closing
42-54% of the interpreted-to-ceiling gap against an oracle that asks for 1.05x.

Two measurement fixes were needed before either number could be read:

- The ladder's `selector attrs` column is sampled after settle, which for a
  program-painted cell reads what the adopting commit decided rather than what
  painted. It now samples the regime at the first painted frame as well, twice
  per cell; there the program cell is 1000/0, 10000/0 and 30000/0 in every
  reading. The settled column's 4,028-or-0 alternation at 1,000 rows is
  therefore a post-first-frame install, not a first-screen path that varies.
- `prototype/adoption-probe.mjs` is new: node identity across a hold, so an FCP
  number can be read as adoption rather than a fast paint followed by a repair.
  All four cell/scale pairs measured are adopted.

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