Skip to content

bench(lynx-table): attribute the compiled first screen at the host boundary - #183

Merged
Huxpro merged 1 commit into
new-lynxfrom
feat/lynx-first-screen-attribution
Aug 26, 2026
Merged

Huxpro merged 1 commit into
new-lynxfrom
feat/lynx-first-screen-attribution

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary

#181 reported issue-#163's compiled main-thread program at 1.24–1.38× the
hand-written L0 prototype and could not say what the difference was made of. It
guessed "per-node work the program has not removed". This adds both cells to the
Element PAPI boundary instrument and measures it instead.

The guess was wrong in the part that matters. The crossings are almost gone;
what remains is script above the boundary.

Why

#163's oracle asks for 1.05× and the ladder measures 1.24–1.38×. A wall-clock
ratio cannot say whether that residue is reachable, and every plausible next
slice — fewer crossings, a cheaper composition, a different publication shape —
aims at a different term. stages/papi-run.mjs wraps the single Object.assign
with which @lynx-js/web-core installs the Element PAPI, so it observes the host
boundary rather than any framework and applies to all three cells by
construction.

Both new cells carry a click-driven shell and a pre-populated ladder variant, so
both windows are measured for both rather than one being borrowed from the other.
prototype/build.mjs copies its pageConfig and styleInfo from the octane bundle,
so the main-thread/background program pair is the only variable between them.

Results

The crossings, and they are specific

FCP@10,000, host call counts, one counts sample per cell:

host call octane +program octane-direct
__GetElementUniqueID 70,042 20,001 1
__SetAttribute 40,028 0 0
every other kind identical identical identical
total 310,195 220,126 200,127
per row 31.02 22.01 20.01

The interpreted first screen crosses 11.01 times per row more than the
prototype. The compiled program removes 9.00 of those 11.01 — every one of
the 40,028 __SetAttribute calls, which is the octane-ref selector regime
#181 reported at the first painted frame, now confirmed independently at the
host boundary — and five of the seven per-row identity reads.

It leaves exactly 2.00 per row, all __GetElementUniqueID. Those are
first-tree capture reading each event-bound node's native ID so the background
can address it (packages/lynx/src/core/host-driver.ts:4210), and the row binds
exactly two events, which is why the number is two. Identical shape at 1,000
rows: 7.04 / 4.03 excess for octane, exactly 2.00 for the program.

Crossings are not where the gap is

FCP@10,000, timed medians in ms:

segment octane +program octane-direct +program − direct
start_delay 21.0 20.3 2.5 +17.8
papi_create 576.1 571.0 548.7 +22.3
papi_props 116.3 66.8 71.2 −4.4
papi_events 42.0 38.4 33.8 +4.6
papi_topology 76.9 69.2 56.3 +12.9
papi_read 31.8 8.2 0.0 +8.2
papi_flush 150.5 137.5 139.4 −1.9
off_boundary 597.4 379.3 172.0 +207.3
wall (control) 1331.1 1092.0 850.1 —

The 283 ms residue at 10,000 rows divides roughly 73% off_boundary, 6%
start_delay, 15% host time inside the boundary
. At 1,000 rows the same three
are roughly 56 / 34 / 13, because start_delay is a fixed ~18 ms of
main-thread chunk evaluation (216 KB against the prototype's 20 KB) that
amortises away with scale.

Two consequences worth stating plainly:

  • papi_flush is 137.5 ms against the prototype's 139.4 ms. The compiled
    first screen is already at the publication floor. There is nothing to win
    there.
  • The 20,000 identity reads are worth about 8 ms — 2.9% of the residue.
    Removing them is right, but it is not what closes 1.28× to 1.05×.

So the residue is dominated by framework script above the boundary. Both cells
issue near-identical host call streams into the same composed tree, so the
browser's style, layout and paint cannot account for a 207 ms difference; what
can is the caller that computes what to pass. Splitting off_boundary by phase
needs a profile build of this cell, which does not exist yet — that is the next
slice, and it is now a well-posed one.

Medians per segment do not sum exactly to the wall difference; the identity is
exact per sample, and the report says so.

Changes

  • benchmarks/lynx-table/stages/papi-run.mjs — octane-mts-program and
    octane-direct cells, buildOctaneVariants({ mtsProgram }), and
    buildDirectPrototype(), which runs after the octane variants because the
    prototype is assembled from their artifacts.
  • benchmarks/lynx-table/README.md — §6 gains the two cells: the command, the
    counts table, what the 2.00 per row are, and the 73/6/15 split with the
    publication-floor result.
  • benchmarks/lynx-table/stages/results/c163-attr-*.{md,json} — the committed
    evidence.

Two defects found while doing the above, both fixed here:

  • The report heading was pinned to the baseline's three cells. --label
    exists precisely so a different cell set can be measured beside the baseline,
    so every labeled run was captioned with cells it did not contain — the
    checked-in papi-firstscreen-boundary.md said "Octane vs ReactLynx vs Vue
    vdom+IFR+ET" over two Octane columns. The heading now comes from the run's own
    cell list. Re-rendering both baselines from their frozen JSON leaves
    papi-boundary.md byte-identical and changes only that one wrong line,
    which is the evidence that this is a caption fix and nothing else.
  • instrument-source.test.mjs staged a hand-written transitive closure that
    had gone stale.
    main-renderer.ts gained an import of core/first-screen.ts
    and the test could no longer link (Could not resolve "./core/first-screen.js").
    Red at base — confirmed by stashing this diff and re-running — green now. It
    matters here because that instrument is what would split off_boundary by
    phase.

No changeset. No published package changes: benchmark harness, README and
records.

Validation

Run on feat/lynx-first-screen-attribution:

  • node --test stages/*.test.mjs — 71/71 pass (70/71 with 1 fail at base)
  • node benchmarks/lynx-bundle-size/core-switch.mjs — exit 0
  • node benchmarks/bench.mjs --only lynx-table --ratios — PASS, 26/303
    guards checked, none breached
  • pnpm typecheck — pass, zero error TS
  • pnpm sync — clean
  • pnpm format:files:check — clean
  • pnpm test — not run; this diff is benchmark harness, README and records,
    and no vitest project covers benchmarks/
  • 30,000 rows — not measured. 1,000 and 10,000 bracket the ladder's tightest
    (1.23×) and a loose (1.37×) point; 30,000 would cost another window and
    the two scales already disagree about start_delay's share, which is the
    thing scale changes.

Measurement protocol: n=5 per variant per cell, three variants (control /
counts / timed) rotating within one host window, fresh page per sample, host
load 0.39 → 1.51 over 4 CPUs. The counts build agrees with the timed build on
every cell, which is the control on the timed build's own cost.

Risk / follow-ups

  • The off_boundary split is the next slice and needs an
    octane-mts-program-profile cell: the phase marker is gated on
    __OCTANE_LYNX_PROFILE__ and folds out of a shipping bundle, so it takes a
    separate build, which is excluded from cross-cell deltas by design.
  • The 2.00 reads per row are a real but small target (~8 ms at 10,000 rows).
    Worth doing on its own terms; not worth claiming as the path to 1.05×.
  • off_boundary remains a remainder, not a direct observation. It holds
    framework script, the browser's style/layout/paint, and the timed probe's
    bookkeeping, and the host exposes no boundary separating them. The inference
    that the 207 ms is script rests on the two cells' call streams being
    near-identical, which the counts table shows but does not prove for the
    browser's side.
  • start_delay is a bundle-size effect, so it is a real cost of shipping a
    framework and not an artefact — but it is fixed, and at 30,000 rows it would
    be a smaller share still than the 6% measured at 10,000.

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

…undary

The FCP ladder reports issue-#163's compiled main-thread program at 1.24-1.38x
the hand-written L0 prototype and cannot say what the difference is made of.
The C4b report guessed "per-node work the program has not removed". The host
boundary instrument can answer it, so this adds both cells to it and measures.

The guess was wrong in the part that matters. At 10,000 rows the compiled
program crosses the boundary 220,126 times against the prototype's 200,127 and
the interpreted screen's 310,195, and the excess is exactly one call kind:
__GetElementUniqueID, at exactly 2.00 per row. The program removes every one of
the interpreted screen's 40,028 __SetAttribute calls -- the octane-ref selector
regime -- and five of its seven per-row identity reads. What is left is
first-tree capture reading each event-bound node's native ID so the background
can address it, and the row binds exactly two events.

But crossings are not where the remaining gap is. The 283 ms residue at 10,000
rows is roughly 73% off_boundary, 6% start_delay and 15% host time; at 1,000
rows 56/34/13, because start_delay is a fixed ~18 ms of main-thread chunk
evaluation that amortises. papi_flush is 137.5 ms against the prototype's
139.4 ms, so the compiled first screen is already at the publication floor. The
residue is framework script above the boundary, and the 20,000 identity reads
are about 8 ms of it.

Also here, both found while doing the above:

- The report heading was pinned to the baseline's three cells, so every
  --label run was captioned with cells it did not contain. The checked-in
  papi-firstscreen-boundary.md said "Octane vs ReactLynx vs Vue vdom+IFR+ET"
  over two Octane columns. The heading now comes from the run's own cell list;
  re-rendering the baselines from their frozen JSON leaves papi-boundary.md
  byte-identical and changes only that one wrong line.
- instrument-source.test.mjs staged a hand-written transitive closure that had
  gone stale: main-renderer.ts gained an import of core/first-screen.ts and the
  test could no longer link. Red at base, green now.

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