Repository navigation
bench(lynx-table): attribute the compiled first screen at the host boundary - #183
Merged
Merged
Conversation
…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
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
#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.mjswraps the singleObject.assignwith which
@lynx-js/web-coreinstalls the Element PAPI, so it observes the hostboundary 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.mjscopies 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:
octane+programoctane-direct__GetElementUniqueID__SetAttributeThe 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
__SetAttributecalls, which is theoctane-refselector 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 arefirst-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 bindsexactly 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:
octane+programoctane-direct+program− directThe 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 threeare roughly 56 / 34 / 13, because
start_delayis a fixed ~18 ms ofmain-thread chunk evaluation (216 KB against the prototype's 20 KB) that
amortises away with scale.
Two consequences worth stating plainly:
papi_flushis 137.5 ms against the prototype's 139.4 ms. The compiledfirst screen is already at the publication floor. There is nothing to win
there.
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_boundaryby phaseneeds 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-programandoctane-directcells,buildOctaneVariants({ mtsProgram }), andbuildDirectPrototype(), which runs after the octane variants because theprototype is assembled from their artifacts.
benchmarks/lynx-table/README.md— §6 gains the two cells: the command, thecounts 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 committedevidence.
Two defects found while doing the above, both fixed here:
--labelexists 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.mdsaid "Octane vs ReactLynx vs Vuevdom+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.mdbyte-identical and changes only that one wrong line,which is the evidence that this is a caption fix and nothing else.
instrument-source.test.mjsstaged a hand-written transitive closure thathad gone stale.
main-renderer.tsgained an import ofcore/first-screen.tsand 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_boundarybyphase.
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 0node benchmarks/bench.mjs --only lynx-table --ratios— PASS, 26/303guards checked, none breached
pnpm typecheck— pass, zeroerror TSpnpm sync— cleanpnpm format:files:check— cleanpnpm test— not run; this diff is benchmark harness, README and records,and no vitest project covers
benchmarks/(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 thething 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
off_boundarysplit is the next slice and needs anoctane-mts-program-profilecell: the phase marker is gated on__OCTANE_LYNX_PROFILE__and folds out of a shipping bundle, so it takes aseparate build, which is excluded from cross-cell deltas by design.
Worth doing on its own terms; not worth claiming as the path to 1.05×.
off_boundaryremains a remainder, not a direct observation. It holdsframework 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_delayis a bundle-size effect, so it is a real cost of shipping aframework 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
__FlushElementTreeis 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
agent-authored)Generated by Claude Code