Skip to content

test(bench): port the Element PAPI boundary instrument onto new-lynx - #151

Merged
Huxpro merged 4 commits into
new-lynxfrom
feat/lynx-papi-boundary-instrument
Aug 25, 2026
Merged

Huxpro merged 4 commits into
new-lynxfrom
feat/lynx-papi-boundary-instrument

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Issue #148 W0: put the host-boundary instrument on new-lynx before anything
about Lynx FCP is claimed here.

Every number the campaign is arguing from was measured on main — the
+18.8% / +33.6% / +45.0% first-screen excess at 1k/10k/30k, the ~27% share
__FlushElementTree publication owns of it, the 16.7–20.1% captureLynxFirstTree
paint delay. new-lynx has moved underneath all of it since: the L3 direct
first-screen applier, #113's direct first-screen lists, #109's first-screen
records, #110's decline-before-paint, #132's announce-from-composing. Those
figures are history, not a baseline, until the same instrument runs on this
branch.

The probe is host-side, which is what makes it usable across frameworks.
@lynx-js/web-core installs the whole Element PAPI onto the hidden main-thread
script realm with a single Object.assign from LynxViewInstance.onPageConfigReady.
papiInstrumentJs wraps that one assignment, so the identical instrument measures
Octane, ReactLynx, and the Vue cells by construction. No framework is patched, no
reference bundle is rebuilt, and the vendored bundles keep the hashes the featured
runs recorded.

This PR is the tooling and its unit tests. The new-lynx baseline it exists to
produce is measured next and pushed onto this branch, so nothing here is yet a
claim about this branch's FCP.

Why

stages/run.mjs decomposes Octane from inside Octane, so every segment stops at
the Element PAPI call and the entire far side — prop and insertion work,
__FlushElementTree, Web Core DOM publication, style, layout, observer delay —
collapses into one layout_flush_residual. That residual cannot be compared
against a framework whose internals are not instrumented, which is exactly what
the FCP question needs. This measures the other side of the same call.

Changes

Ported from the issue-#50 branch and re-derived against this base rather than
copied across:

  • stages/papi-run.mjs, papi-analyze.mjs, papi-report.mjs,
    papi-analyze.test.mjs, papi-predicate-cost.mjs — new, unchanged from the
    reviewed originals.
  • web/driver-client.mjs takes the probe as a patch rather than wholesale,
    because new-lynx has since added countAttribute to the same file. Adds
    papiInstrumentJs, shellCount/shellAtLeast, papiSnapshot, and the
    boundary counters on the FCP and predicate resolutions.
  • The main-era results are deliberately left behind. papi-{1000,10000,30000}.json,
    papi-boundary.md, papi-scaling.json and the predicate-cost record are frozen
    main measurements; re-landing them here would read as a new-lynx baseline
    that was never taken on new-lynx.
  • chromiumLaunchOptions replaces the two open-coded chromium.launch blocks in
    stages/run.mjs and web/run-web.mjs, so all three harnesses resolve a
    provided Chromium the same way instead of only one of them doing it.
  • stages/analyze.test.mjs anchored its two esbuild import paths to the process
    working directory, so pnpm test:stages — its own package script — could only
    pass from the repository root. Both are now anchored to the test file, and the
    suite passes from either location.
  • README gains the instrument section, renumbered to 6 and its subheading
    disambiguated, since this base already carries five numbered sections and an
    ### Observation contract under section 3.

No package source is touched, so there is no changeset.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test — ran to completion on this head: 4 failed | 21,226 passed
    (21,230)
    across 2,208 files, 2,388 s. All four are pre-existing or
    environmental, and none can be reached by this diff: it is 17 files under
    benchmarks/ plus one .gitignore rule, with no packages/ source at all.
    - rspeedy-plugin-octane native-demo "escalates cleanup for a detached
    descendant" — the known pre-existing container failure recorded in Execution plan (#58): complete L2, then drive L4→L6 — full context handoff #66 §2.3.
    - drei upstream-e2e — the scene never finishes because
    potsdamer_platz_1k.hdr cannot be fetched in this sandbox, and the
    waitForFunction then times out.
    - syntax-highlighter light-async — passes 5/5 when that file is run on
    its own; a full-run-only snapshot interaction.
    - octane suspense-hydration "restores focused input and its selected
    text after a keyed DOM reorder" — reproduces in isolation on a quiet host,
    so it is not a load flake. It is also not this branch's:
    packages/octane/src/runtime.ts and
    packages/octane/tests/browser/suspense-hydration/ are byte-identical
    between origin/main and origin/new-lynx, so main fails it the same
    way. Reported separately rather than absorbed here.
  • targeted tests: node --test benchmarks/lynx-table/stages/*.test.mjs —
    32/32, from the repository root and from the package directory (the
    second location is what the path-anchoring fix above buys).
  • end-to-end smoke on this base: node stages/papi-run.mjs --smoke --scales 1000
    drove all three page variants (control, counts, timed) against all
    three cells and reported startup, create, and — for Octane — a direct FCP
    window. Not reportable by construction (n=1); it proves the harness runs
    here, nothing more.

Risk / follow-ups

  • The baseline has since landed on this branch (--reps 5 at 1k/10k/30k on a
    quiet host), which is what re-establishes the excess and the publication share
    for new-lynx rather than quoting main. It moves both: the first-screen
    excess over Octane's own post-mount create path is +9.7% / +18.0% / +28.5% at
    1k/10k/30k here, against the +18.8% / +33.6% / +45.0% recorded on main; and
    publication's share nets down to 0% / 7% / 17% once the topology work it
    absorbs is subtracted, rather than the near-constant ~27% the main figure
    read as. The decomposition is in stages/results/papi-boundary.md.
  • --smoke writes results/papi-smoke.json and is not a reportable artifact;
    only papi-run.mjs without --smoke produces one.
  • The timed build costs more than the control, so its numbers are used for
    shares and never for wall-clock claims; what that overhead actually is on this
    base comes from the baseline run, not from the recorded main figure. The
    counts build is the control on it: both builds count identically by
    construction, and the report prints the agreement per cell, so a costlier pass
    that disagrees on what the framework called cannot pass as the same workload.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

Issue #148 W0 asks for the instrument before any FCP claim: the +18.8/33.6/45.0%
first-screen excess and the ~27% publication share on file were all measured on
main, and new-lynx has moved under them (#108-#113 direct first screen, #109
first-screen records, #110 decline-before-paint, #132 announce-from-composing).
Nothing may be claimed here until this harness runs here.

The probe is host-side, not framework-side. @lynx-js/web-core installs the whole
Element PAPI onto the hidden main-thread script realm with one Object.assign
from LynxViewInstance.onPageConfigReady; papiInstrumentJs wraps that single
assignment, so the identical instrument measures Octane, ReactLynx, and the Vue
cells by construction. No framework is patched, no reference bundle is rebuilt,
and the vendored bundles keep the hashes the featured runs recorded.

Ported from the issue-#50 branch and re-derived against this base rather than
copied wholesale:

- driver-client.mjs takes the probe as a patch, because new-lynx has since added
  countAttribute to the same file.
- The main-era results JSON is deliberately left behind. papi-{1000,10000,
  30000}.json, papi-boundary.md, papi-scaling.json and the predicate-cost record
  are frozen main measurements; re-landing them here would read as a new-lynx
  baseline that was never taken on new-lynx.
- chromiumLaunchOptions replaces the two open-coded launch blocks in stages/
  run.mjs and web/run-web.mjs, so all three harnesses resolve a provided
  Chromium the same way instead of only one of them.
- analyze.test.mjs anchored its two esbuild import paths to the process working
  directory, so `pnpm test:stages` -- its own package script -- could only pass
  from the repository root. Both are now anchored to the test file.

The README section is renumbered to 6 and its subheading disambiguated, since
this base already carries five numbered sections and an "Observation contract"
under section 3.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
claude added 2 commits August 23, 2026 23:17
`papi-run.mjs --smoke` writes `stages/results/papi-smoke.json` so a smoke
exercises the same reporting path it is checking. That directory holds
committed evidence, and an n=1 non-interleaved run is not evidence: left
untracked it invites being committed beside records that were measured
properly.

The reportable artifacts in the same directory -- papi-<rows>.json,
papi-boundary.md, papi-scaling.json -- stay committed.

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

The instrument's whole purpose is that nothing about this branch's FCP is
claimed from a main-era measurement. This is the measurement.

n=5 per variant per cell at 1k/10k/30k, fresh page per sample, control/counts/
timed rotating inside one host window, quiet host (1-minute load 0.43 at start,
1.39 at end over 4 CPUs). Both builds agree on counts in every cell, which is
the control on the timed build's 1.06-1.17x cost.

Octane's first-screen excess over its own post-mount path for the identical
tree, which is what the issue-#148 oracle is written against:

  1,000    16.1 ms    9.7%   (main-era record: +18.8%)
  10,000  204.2 ms   18.0%   (main-era record: +33.6%)
  30,000  898.7 ms   28.5%   (main-era record: +45.0%)

The main-era figures are beside them as history, not as a comparison: they were
taken on a different branch and a different host, and only the same-window
numbers on each row are claimed.

Two things the decomposition says that the main-era framing did not:

Publication is not the owner it was recorded as. papi_flush gains 11.5/123.7/
456.8 ms on the first-screen path while papi_topology loses 11.5/109.4/304.3 ms,
because the page is detached until the first flush -- so the same node
insertions are billed to flush there and to topology on the create path. Netted,
publication owns 0% of the excess at 1k, 7% at 10k, 17% at 30k, not a
near-constant 27%.

The first-screen path issues 11 more host calls per row than the create path
for the same rendered tree: 7 __GetElementUniqueID and 4 __SetAttribute, neither
of which the create path issues at all. That is 330,000 extra host calls at 30k,
worth 17.3/44.5 ms of papi_read and 28.0/91.8 ms of papi_props at 10k/30k. Both
are Octane-owned and both sit before paint.

Absolute milliseconds here are host-bound and are not comparable to any other
session or host; the shares and the same-window ratios are the portable claims.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
…he fcp tick walking twice

- The deltas block and firstScreenControl dereferenced cells.octane
  unconditionally, so any --cells value without octane crashed after the
  whole measurement window and lost every collected sample. Both now
  degrade to no-deltas / no-control, pinned by a red-verified regression.
- runFcpSample passed an explicit contentAtLeast spec, so every pre-paint
  polling frame walked the composed tree twice; { minContent: rows } is
  the same boundary on the count the tick already computed, matching
  run-fcp.mjs and stages/run.mjs.
- Deleted the dead round() copy in papi-run.mjs; rendering owns rounding.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YHfFsy9CLaRovTFH8pTGyY
@Huxpro
Huxpro marked this pull request as ready for review August 25, 2026 08:56
@Huxpro
Huxpro merged commit 34fd717 into new-lynx Aug 25, 2026
8 of 12 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