Skip to content

test(bench): split the FCP remainder into phases, and repair the profiler that names its functions - #254

Merged
Huxpro merged 3 commits into
new-lynxfrom
perf/lynx-c247-bucket4-split
Aug 31, 2026
Merged

Huxpro merged 3 commits into
new-lynxfrom
perf/lynx-c247-bucket4-split

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

#247's Order 1 put 63–83% of the FCP@10k gap in off_boundary and refused to name an owner, because a named remainder nominates nobody. It called for an instrumentation slice before a bucket-4 verdict could exist. This is that slice.

The phase instrument already existed and had simply never been run beside a reference. papi-run.mjs splits off_boundary into the framework's own first-screen phases — render, publish, capture, announce — plus the residue nothing framework-side claims, for any run whose cells include octane-profile. The Order-1 run used octane,react,react-first-screen, so no split was produced. Two windows with octane-profile in them are checked in here.

Result at 10,000 rows (c247-o2-bucket4-* / c247-o2-bucket4-b-*, medians of 5, both windows shown):

window A window B
Octane off_boundary, shipping cell 558.5 543.8
Octane off_boundary, profiled cell 599.9 594.5
→ render 91.8 85.7
→ publish 362.1 349.6
→ capture 53.3 50.9
→ announce 0.0 0.0
→ Octane first-screen script 505.0 516.3
→ residue — web-core script and the browser frame 94.9 92.7
react-first-screen off_boundary (whole bucket 4) 223.3 237.9

84.2% and 86.8% of Octane's remainder is Octane's own first-screen script. The vendored reference carries no phase marker and cannot be given one, so its bucket 4 has no parts — which is why the comparison that carries the verdict is Octane's framework row against the reference's whole remainder: 505.0 vs 223.3 and 516.3 vs 237.9, an excess of 281.7 and 278.4 ms, 1.2% apart. That subtracts nothing on the reference side, so it holds however React's own remainder divides internally.

The function-level instrument beneath that was refusing every run, and its two defects are fixed here.

mts-profile.mjs identified the main-thread script by patching URL.createObjectURL and keeping what the page minted. Observed: that list came back holding one blob URL, and it was not the one the profiled frames ran from — so every run died with produced no main-thread script frames; the profile named none. The script is now read from the about:srcdoc realm's own <script src="blob:…">, which is the document being attributed rather than a guess from another realm's traffic.

With that running, applier walk read 0.0 ms while visit and pushChildren sat in unmatched at 93.5 and 18.0 ms — the two largest unnamed frames in the run. Its probe was physicalParent, taken from a visit that destructured its frame at the top; the dense-span fast path now runs before that destructuring and pushed the probe past the 160-character window. Two probes replace it, one per function, ordered so the narrower wins.

Naming those frames moves the run's unnamed share from 41.4% to 13.0%, and the repaired bucket reads 111.2 ms against the 113.7 ms the pre-drift record mts-profile-10000.md measured — a number the repair had to reproduce and was not fitted to.

Changes

  • stages/mts-profile.mjs — identify the profiled script from the main-thread realm's own <script>; drop the mint interception; correct the stale doc comment.
  • stages/mts-profile-buckets.mjs — replace the drifted applier walk probe with one per function, pushChildren first because it initialises the field visit is named by.
  • stages/mts-profile.test.mjs — current-build fixtures for both walk frames, and two tests pinning the drift class.
  • stages/results/c247-o2-* — the three records: two boundary windows and one profile window.
  • docs/measurement/fcp-attribution.md — the bucket-4 procedure: both instruments, the rule that licenses the comparison above, and the trap of adding two windows together.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test
  • targeted tests: node --test stages/*.test.mjs — 186 passed, 0 failed (18 suites), including the two new ones.
  • pnpm format:files:check on every changed file — clean.
  • pnpm sync — no generated changes.
  • Red-verified: restoring the old physicalParent probe fails the two new tests and the fixture test beside them; restoring the fix passes all 30.

Not run: pnpm typecheck and pnpm test. This diff touches no TypeScript and no package source — it is benchmark harness JavaScript, checked-in evidence records, and one document. The harness's own suite is the one that covers it and it is green above.

Measurement conditions are in each record's header: 4× Xeon @ 2.10GHz, Chromium 141.0.7390.37, @lynx-js/web-core 0.22.2, quiet-host preflight passed on every run (load 0.03–0.09 at start).

Risk / follow-ups

  • Base. This stacks on bench/lynx-react-first-screen-cell (test(bench): give the FCP window a reference control #251), because the react-first-screen cell is what puts a reference in the same window. Retarget to new-lynx once that merges.
  • The branch name deviates from the harness's assignment. This session was assigned claude/octane-issue-66-phase-a-7wz97z, but .github/workflows/label-pr.yml derives the type label from a feat/|fix/|docs/|test/|perf/ prefix, so a topic branch is used. Flagging rather than hiding it.
  • 13.0% of the profiled script is still unnamed, and it nominates nobody. The largest remaining frames are a compiler-emitted object-spread helper (11.9 ms) and a recursive node counter over plan.nodes (8.2 ms twice).
  • The two instruments do not reconcile and are not meant to. The phase split puts Octane's first-screen script at 505.0 ms while the profiler sees 392.4 ms of main-thread self time in its own window. Different windows, one of them sampled. They agree on ordering and roughly on shares; nothing here subtracts one from the other.
  • The bucket-4 delta is less stable than Order 1 reported. It reads 335.2 and 305.9 ms here against 298.5 and 291.4 ms in the Order-1 windows — a 15% spread, wider than those two windows' mutual 2%. The reference side is steady across all four (222.7 / 238.6 / 223.3 / 237.9); the widening is Octane's. A three-cell interleave is not the two-cell interleave Order 1 ran, which is the obvious suspect and is not established. The verdict above does not rest on the delta.
  • The stage harnesses have no CI coverage. No workflow runs test:stages, and pnpm test does not fan out to it. That is why an instrument could refuse every run and a probe could empty its bucket without anything going red. Worth a follow-up issue; deliberately not widened into this diff.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

…iler that names its functions

#247's Order 1 put 63–83% of the FCP@10k gap in `off_boundary` and declined to
name an owner for it, because a remainder cannot nominate one. The instrument
that observes inside it already existed — `papi-run.mjs` splits `off_boundary`
by first-screen phase for any run whose cells include `octane-profile` — and
had simply never been run in a window that also carried a reference. Two such
windows are checked in here, `c247-o2-bucket4-*` and `c247-o2-bucket4-b-*`:
octane, octane-profile and react-first-screen at 1,000 and 10,000 rows, five
repetitions each, one interleaved window per record.

At 10,000 rows the framework's own first-screen script is 505.0 and 516.3 ms of
Octane's `off_boundary` across the two windows, against a residue of 94.9 and
92.7 ms for web-core's script and the browser's frame. The reference's entire
`off_boundary` is 223.3 and 237.9 ms in the same windows, so Octane's script
alone exceeds the whole of the reference's remainder by 281.7 and 278.4 ms —
the steadiest quantity in the measurement, 1.2% apart. The comparison subtracts
nothing on the reference side, which is what makes it hold without a phase
marker the vendored bundle cannot carry.

The function-level instrument beneath that was refusing every run, and its two
defects are fixed here.

`mts-profile.mjs` identified the main-thread script by patching
`URL.createObjectURL` and keeping what the page minted. That list came back
holding one blob URL that was not the one the profiled frames ran from, so the
run refused with "the profile named none". The script is now read from the
`about:srcdoc` realm's own `<script src="blob:…">`, which is the document being
attributed rather than a guess from another realm's traffic.

`applier walk` then read 0.0 ms while `visit` and `pushChildren` sat in
`unmatched` at 93.5 and 18.0 ms — the two largest unnamed frames in the run.
Its probe was `physicalParent`, taken from a `visit` that destructured its frame
at the top; the dense-span fast path now runs before that destructuring and
pushed the probe past the 160-character window. Two probes replace it, one per
function, ordered so the narrower one wins. Naming those frames moves the run's
unnamed share from 41.4% to 13.0%, and the repaired bucket reads 111.2 ms
against the 113.7 ms the pre-drift record `mts-profile-10000.md` measured — a
number the repair had to reproduce and was not fitted to.

Red-verified: restoring the old probe fails the two new tests and the fixture
test beside them, and passes again when it is put back.

`docs/measurement/fcp-attribution.md` gains the procedure for both instruments,
including the rule that licenses the comparison above and the trap of adding
two windows together.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Huxpro and others added 2 commits August 31, 2026 14:59
#254's base branch bench/lynx-react-first-screen-cell landed in new-lynx as
#251, so the PR retargets to new-lynx and takes the base directly.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
… which window it comes from

The phase split invites two different shares and #254 reported them by hand.
Only one of them is section 3's: framework excess over the FCP gap is a claim
about the reference, while framework over Octane's own bucket 4 is a
composition statement about one cell that says nothing about it. Quoting the
second as the first overstates the finding by about 22 points, so the report now
emits both with their denominator named beside them and no reader has to
reconstruct either.

The gap denominator is the timed FCP walls, the same one attributeDelta divides
by and the window the numerator's off-boundary terms come from. Taking it from
the control walls instead divides a timed numerator by an uninstrumented
denominator, and the mismatch is not small: it moves this share from 61.6%/61.9%
across the two same-code windows to 68.0%/85.0%. Both the unit test and the
rendered-report test fail on that substitution, and were seen to.

fcp-attribution.md gains the two subsections the split was missing: which
denominator each share uses and why they are not interchangeable, and the
split's own resolution measured the way section 3 measured the ratio's. Section
3's +/-0.04 is the resolution of a single-window FCP ratio and does not transfer
here. From the two same-code windows, the gap share replicates to 0.003 and the
own-bucket share to 0.027, while frameworkMs spreads 11.2% and 11.5% within a
single window -- the derived shares are steadier than the terms they are built
from, because a hot window is hot for both cells and the common-mode drift
divides out of a ratio taken inside it. It does not divide out of a millisecond.

Also records that frameworkMs and residueMs are medians of their own per-sample
series, so summing the four phase medians by hand gives a different and wrong
answer, and that #254's base branch landed in new-lynx as #251, which this
merge takes directly.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
@Huxpro
Huxpro changed the base branch from bench/lynx-react-first-screen-cell to new-lynx August 31, 2026 15:08

Huxpro commented Aug 31, 2026

Copy link
Copy Markdown
Owner Author

Pushed aa665c71c. Three things, and one of them is a defect in how this PR reported its own numbers.

Retargeted to new-lynx, and took the base. This PR was opened against bench/lynx-react-first-screen-cell, which has since landed as #251, so the base is now new-lynx and 0da02902b merges it in (a merge, not a rebase — the branch is published). The full stage suite runs green on the merged head: 191 pass, 0 fail (node --test stages/*.test.mjs), against a 184-pass baseline on new-lynx itself, +2 from this PR's original commit and +5 added below.

The two shares were reported by hand, and only one of them is section 3's. The body above quotes both — "84.2% and 86.8% of Octane's remainder is Octane's own first-screen script", and the 281.7/278.4 ms excess — but neither is emitted by the harness, and they divide by different things:

share denominator what it answers
framework ÷ Octane's own bucket 4 octane-profile off-boundary how much of Octane's remainder is Octane's script
framework excess ÷ the FCP gap median(octane fcp total) − median(reference fcp total) how much of the gap that excess accounts for

Only the second uses section 3's denominator and only the second is a claim about the reference. Quoting the first as a share of the gap overstates the finding by about 22 points. The report now emits both with the denominator named beside each, so neither has to be reconstructed:

| framework ÷ Octane's own bucket 4 | `octane-profile` off-boundary, 599.9 ms | 84.2% |
| framework excess ÷ the FCP gap | `octane` FCP wall − `react-first-screen` FCP wall, 457.1 ms | 61.6% |

The gap denominator has to come from the timed window, and getting that wrong is not a rounding difference. The numerator's off-boundary terms are timed-build quantities, so the denominator must be too — which is also the denominator attributeDelta already divides by. I first wrote it against the control walls, and the two same-code windows then disagreed by 0.17: 68.0% and 85.0%, against 61.6% and 61.9% taken correctly. Both the unit test and the rendered-report test fail on that substitution; I reverted the fix to watch them go red (13 pass / 2 fail) before restoring it.

Worth recording beside it: frameworkMs and residueMs are each the median of their own per-sample series, so summing the four phase medians by hand gives a different answer — 486.2 rather than 516.3 in window B. The body's numbers are right because they came from the harness fields; a reader reconstructing them from the phase rows would not have been.

What this makes of the ±0.04 line. Section 3's ±0.04 is the resolution of a single-window FCP ratio and does not transfer to this split, so fcp-attribution.md now carries the split's own, measured the same way — from the two same-code windows:

quantity window A window B spread
frameworkMs 505.0 516.3 11.3 ms (2.2%)
residueMs 94.9 92.7 2.2 ms (2.3%)
framework excess over the reference's whole bucket 4 281.7 278.4 3.3 ms (1.2%)
framework ÷ own bucket 4 0.842 0.869 0.027
framework excess ÷ FCP gap 0.616 0.619 0.003

The derived shares are steadier than the terms they are built from, and not by luck: within a single window frameworkMs spreads 11.2% and 11.5% across its five repetitions and residueMs up to 26.5%, but a window that runs hot runs hot for both cells, so the common-mode drift divides out of a ratio taken inside it. It does not divide out of a millisecond.

So the ordering of what to quote is the reverse of what the raw numbers suggest: the gap share replicates to 0.003 and is what a verdict should rest on; the millisecond excess replicates to 1.2% and is good for sizing; the individual phase milliseconds are the least stable thing here and should be read as an ordering, not as quantities.

Bucket 4 is now an observable segmentation rather than a named remainder, which is what #247's Order 1 asked for before a bucket-4 verdict could exist: the framework/residue split comes from the phase marker, both shares come out of the harness with their denominators named, and the split's resolution is measured rather than borrowed.

Staying a draft. CI is still wedged, so nothing has run against this head but the local suite quoted above.


Generated by Claude Code

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