Skip to content

test(bench): report which selector regime an FCP arm ran in - #133

Merged
Huxpro merged 4 commits into
new-lynxfrom
test/lynx-first-screen-fcp
Aug 21, 2026
Merged

Huxpro merged 4 commits into
new-lynxfrom
test/lynx-first-screen-fcp

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #132. This is the instrument half of turning that PR's count into
a wall-clock number; the measurement itself is running and lands on this branch
as a second commit.

prototype/run-fcp.mjs now reports how many nodes carry the octane-ref
selector attribute, per sample and per cell, beside the FCP it measured.

Why

#131 and #132 are counts taken at the fake Element PAPI in the wire chassis:
40,028 selector writes for a 10,000-row first screen, then 0. The browser
harness does not run that chassis, so nothing in an FCP report says which
regime the arm it timed was actually in.

That matters for the specific comparison this serves. A cell that stamps every
node and a cell that stamps none produce the same-shaped FCP row, so a null
result — the plausible outcome, since setAttribute is cheap — is
indistinguishable from having accidentally measured one build twice. The
selector column is what separates "no effect" from "no difference between the
arms."

Changes

  • web/driver-client.mjs — x.countAttribute(name) counts elements
    carrying an attribute over the composed tree, piercing shadow roots the same
    way findByClass already does. Lynx-for-Web maps papi.setRefSelector onto a
    real DOM attribute, so the page is observable this way.
  • prototype/run-fcp.mjs — each sample records its count; the per-rep log
    line prints it; the report table gains a selector attrs column carrying the
    distinct values seen across samples, so a cell that is not stable in that
    dimension cannot be read as if it were.
  • prototype/run-fcp.mjs — the report heading names its cells rather than
    asserting the fixed octane-vs-direct pair, which stopped being true once
    --extra could add one.

Validation

  • pnpm format:files on both changed files — clean
  • pnpm sync — no generated changes
  • pnpm typecheck — not applicable: benchmarks/lynx-table carries no
    tsconfig, so typecheck:files reports no project includes these files and
    the repo lane does not cover them. Both are .mjs.
  • pnpm test — not run for this diff: it touches only benchmarks/, which
    is in no Vitest project.
  • The harness has not yet been run end to end with this column. That is the
    next commit, and if the probe turns out not to observe the attribute
    through the web host's element model, this column comes out rather than
    shipping as a zero that means "not measured".

Risk / follow-ups

  • The count is taken after settle, not during first paint. For an app that
    announces nothing it is the same number either way; for one that holds refs it
    would report the steady state rather than what was installed eagerly. It is a
    regime indicator, not an install counter — the install counter lives in the
    wire chassis, where it can see the difference.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

A timing comparison for the demand-installed `nodes-ref` selector is
unreadable from the FCP column alone: a cell that stamps every node and a
cell that stamps none look identical there, so an unchanged number cannot
be told apart from an unchanged build. The counts live in the wire
chassis, which the browser harness does not run.

`driver-client.mjs` gains `countAttribute(name)`, walking the same
composed tree — piercing shadow roots — that `findByClass` already walks.
`run-fcp.mjs` reports `octane-ref` per sample and per cell, so every FCP
row carries the regime that produced it.

The report heading now names its cells instead of asserting the fixed
octane-vs-direct pair, which stopped being true once `--extra` could add
one.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
…rect §4

The count harness said 40,028 selector writes become 0. Run in Chromium at
10,000 rows with the background owning the first commit, that buys median
view-attach FCP 2,134.9ms -> 2,102.2ms, about 1.5%, and the ranges overlap:
the eager arm's fastest sample beats every announcing sample. At n=5 that is
not a detectable win. Announcing earns its place on the wire contract and the
per-node work it removes, not as a first-paint lever.

The same run corrects a claim §4 was making. The plugin's main-thread entry
installs with `firstScreen: true`, so an app it builds paints its first screen
through main-thread direct emission and the background adopts it. Both sites
stamp every node by construction and neither reads a commit's announcement, so
a plugin-default build reads 40,028 selector attributes whether or not the
background announces, to within 0.2ms of the same first paint. §4's arms bound
the background-commit path -- a declined `<list>` topology, a host that does
not enable the first screen, any commit after the first -- and no longer claim
the after-render arm is how production starts.

Also recorded: the background-commit path is ~560ms behind direct emission at
this scale, which is the number standing behind that `firstScreen: true`
default. Both figures are Lynx for Web in headless Chromium; native
`__SetAttribute` crosses into engine code and is not measured here.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy

Huxpro commented Aug 21, 2026

Copy link
Copy Markdown
Owner Author

Measured. The selector count goes to zero; first paint does not move — and the production first screen never took this path.

Pushed as 2957245c7: the run, the committed record, and a correction to §4 that this run forced. The body's open box — "the harness has not yet been run end to end with this column" — is closed by this.

prototype/run-fcp.mjs --rows 10000 --reps 5, fresh page per sample, AB/BA, host at 0.12 load, 4× Xeon @ 2.10GHz.

cell first screen painted by announces median FCP ms min–max selector attrs
octane main-thread direct emission yes 1540.6 1468.4–1606.5 40028
octane-eager main-thread direct emission no 1540.8 1438.7–1598.5 40028
octane-bg-announce background commit yes 2102.2 2089.0–2130.4 0
octane-bg-eager background commit no 2134.9 2048.7–2253.2 40028

Four bundles, distinct checksums, differing in one boolean each.

The count result holds in a real browser. bg-eager → bg-announce is 40,028 → 0. The wire chassis was telling the truth about the path it measures.

The timing result is negative, and I am not going to dress it up. 2,134.9 → 2,102.2 ms is ~1.5%, and the ranges overlap — the eager arm's fastest sample (2,048.7 ms) beat every announcing sample. At n=5 that is not a detectable win. Forty thousand setAttribute calls are small against a 2.1-second first paint. #132 earns its place on the wire contract and the per-node work it removes; it is not a first-paint lever, and nothing downstream should cite it as one.

A claim I had to withdraw. packages/rspeedy-plugin-octane/src/main-thread-entry.js installs the main thread with firstScreen: true unconditionally. So an app the plugin builds paints its first screen through applyLynxFirstScreenDirect and the background then adopts it — both eager by construction, neither consulting a commit's announcement. That is why the top two rows are identical at 40,028 and within 0.2 ms of each other: in a plugin-default build, #132 changes nothing about the first screen. §4 of the benchmark README said the after-render arm "matches how production starts"; it does not, and the commit rewrites that paragraph to bound the arms to the background-commit path — a <list> topology direct emission declines, a host that does not enable the first screen, or any commit after the first.

I found this only because the selector column exists. The FCP figures for the top two cells are indistinguishable, so without the count this run would have read as a clean null result rather than as two builds that never differed.

Consequence worth taking seriously before anyone proposes the obvious follow-up. The natural next slice is teaching direct emission and adoption to install selectively, since those two now own the whole 40,028 on the production path. This run argues against spending it: removing exactly those writes on the background path bought nothing measurable, so removing them on the direct path should not be expected to either. I would treat that as NO-GO on first-paint grounds unless someone brings a different reason — retained attribute memory, or native attribute-selector matching cost.

Scope: Lynx for Web in headless Chromium. Native __SetAttribute crosses into engine code and is not measured here, so the NO-GO does not extend to native without its own run.

Incidental, and larger than anything above: the background-commit path is ~560 ms behind direct emission at 10k (2,102.2 vs 1,540.6). That is the measurement standing behind the plugin's firstScreen: true default, and it is now recorded.

One correction to my own method: the first attempt at the bg arms hit FCP DNF. That was my ablation, not a finding — main-thread.ts rejects firstScreenSync/firstScreenRender unless firstScreen === true, so flipping the boolean alone threw at install and nothing painted. Rebuilt with the whole options object emptied.


Generated by Claude Code

@Huxpro
Huxpro changed the base branch from perf/lynx-announce-first-batch to new-lynx August 21, 2026 22:18
@Huxpro
Huxpro marked this pull request as ready for review August 21, 2026 22:18
@Huxpro
Huxpro merged commit fb8426e into new-lynx Aug 21, 2026
1 of 2 checks passed
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.

2 participants