Repository navigation
test(bench): split the FCP remainder into phases, and repair the profiler that names its functions - #254
Conversation
…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
#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
|
Pushed Retargeted to 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:
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: 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 Worth recording beside it: 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
The derived shares are steadier than the terms they are built from, and not by luck: within a single window 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 |
Summary
#247's Order 1 put 63–83% of the FCP@10k gap in
off_boundaryand 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.mjssplitsoff_boundaryinto the framework's own first-screen phases — render, publish, capture, announce — plus the residue nothing framework-side claims, for any run whose cells includeoctane-profile. The Order-1 run usedoctane,react,react-first-screen, so no split was produced. Two windows withoctane-profilein them are checked in here.Result at 10,000 rows (
c247-o2-bucket4-*/c247-o2-bucket4-b-*, medians of 5, both windows shown):off_boundary, shipping celloff_boundary, profiled cellreact-first-screenoff_boundary(whole bucket 4)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.mjsidentified the main-thread script by patchingURL.createObjectURLand 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 withproduced no main-thread script frames; the profile named none. The script is now read from theabout:srcdocrealm's own<script src="blob:…">, which is the document being attributed rather than a guess from another realm's traffic.With that running,
applier walkread 0.0 ms whilevisitandpushChildrensat inunmatchedat 93.5 and 18.0 ms — the two largest unnamed frames in the run. Its probe wasphysicalParent, taken from avisitthat 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.mdmeasured — 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 driftedapplier walkprobe with one per function,pushChildrenfirst because it initialises the fieldvisitis 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:checkpnpm typecheckpnpm testnode --test stages/*.test.mjs— 186 passed, 0 failed (18 suites), including the two new ones.pnpm format:files:checkon every changed file — clean.pnpm sync— no generated changes.physicalParentprobe fails the two new tests and the fixture test beside them; restoring the fix passes all 30.Not run:
pnpm typecheckandpnpm 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-core0.22.2, quiet-host preflight passed on every run (load 0.03–0.09 at start).Risk / follow-ups
bench/lynx-react-first-screen-cell(test(bench): give the FCP window a reference control #251), because thereact-first-screencell is what puts a reference in the same window. Retarget tonew-lynxonce that merges.claude/octane-issue-66-phase-a-7wz97z, but.github/workflows/label-pr.ymlderives the type label from afeat/|fix/|docs/|test/|perf/prefix, so a topic branch is used. Flagging rather than hiding it.plan.nodes(8.2 ms twice).test:stages, andpnpm testdoes 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
agent-authored)Generated by Claude Code