Skip to content

fix(benchmarks): pass stable checksum callbacks in the Three frame bench - #1651

Merged
trueadm merged 1 commit into
mainfrom
fix/three-frame-bench-callbacks
Oct 3, 2026
Merged

trueadm merged 1 commit into
mainfrom
fix/three-frame-bench-callbacks

Conversation

@trueadm

@trueadm trueadm commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The weekly Bench's three-renderer frame_1k_subscribers guard has measured 1.18–1.33× React Three Fiber since #1044 (bisected: c31f629 moves it from 0.93× to 1.34×). Octane's frame dispatch did not get slower. This PR fixes the benchmark artifact behind the breach.

  • perf: bring native hover allocations close to Solid #1044 stopped retaining each effect's previous closures, which is a correct memory release.
  • The bench built a fresh recordFrame arrow on every render(). V8 inlines it into the useFrame loop and holds it weakly.
  • Once Octane frees it, the runner's forced gc() before each sample clears it. V8 then deoptimizes the frame loop ("embedded weak objects cleared"), and the 20 timed frames include re-warming it.
  • R3F avoided this only because React keeps the previous props alive through its alternate fibers, so its call site goes polymorphic and stays optimized.

Both bench pages now pass module-level recordFrame/recordEvent callbacks. The README and the guard note record the cause, and the guard stays at 1.0.

Evidence

Same Chromium, interleaved samples. Base is current main, built unchanged:

Build octane ms/frame r3f ms/frame octane/r3f
main (per-render callbacks) 0.0452 0.0340 1.331
main, with only the previous = null lines removed 0.0285 0.0345 0.826
this PR (stable callbacks) 0.0280 0.0348 0.806

On a single steady mount, without remounting before each sample, Octane is already 0.71× R3F on main. Every three-renderer op is under 1.0 with this change: mount 0.86, update 0.92, reorder 0.73, unmount 0.31, reconstruct 0.83/0.97, frame 0.81, raycast 0.49.

Validation

  • pnpm format:files:check
  • pnpm typecheck (benchmark-only change)
  • pnpm test (benchmark-only change)
  • targeted: interleaved three-renderer runs (all 8 ops) against the production pages; pnpm sync clean

Risk / follow-ups

  • Benchmark-only. The weekly triage waiver for this guard (in the uncommitted bench-gating work) can be dropped once this lands.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Low Risk
Benchmark harness and documentation only; no production runtime or API behavior changes.

Overview
Fixes a methodology bug in the frame_1k_subscribers three-renderer benchmark that made Octane look ~1.33× slower than R3F after #1044, even though dispatch itself did not regress.

Both Octane and R3F bench pages now pass module-level recordFrame and recordEvent instead of new arrow functions on every render(). Per-render callbacks were collected when the scene was replaced and the runner’s forced gc() ran before each sample, which caused V8 to drop optimized frame-loop code that had inlined those closures (“embedded weak objects cleared”) and charged recompilation to the timed frames. R3F mostly avoided that because React kept prior props alive on alternate fibers.

benchmarks/three/README.md and the frame_1k_subscribers note in ratios.json document this so the 1.0× guard measures dispatch, not GC/deopt artifacts.

Reviewed by Cursor Bugbot for commit 886613d. Bugbot is set up for automated code reviews on this repo. Configure here.

frame_1k_subscribers regressed to 1.18-1.33x React Three Fiber at #1044.
Octane's dispatch did not get slower. #1044 stopped retaining each effect's
previous closures, and the bench built a fresh recordFrame callback on every
render(). V8 inlines that callback into the frame loop; once Octane frees it,
the runner's forced gc() before each sample clears it and deoptimizes the loop,
so the timed frames re-warm V8. React keeps the old props alive through its
alternate fibers, so R3F's call site goes polymorphic and stays optimized.

Both pages now pass module-level checksum callbacks. On the unchanged runtime
frame dispatch measures 0.81x R3F, and every three-renderer op stays below 1.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 3, 2026
@trueadm
trueadm marked this pull request as ready for review October 3, 2026 09:24
trueadm added a commit that referenced this pull request Oct 3, 2026
three-renderer frame_1k_subscribers and the two three-bundle-size ratios have
owner PRs (#1651, #1652) that re-note and ratchet those entries, so this branch
drops their waivers instead of editing the same entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No size increases and no timing regressions outside noise.

Compares dc3e18023 with 3f99bccbc on the same runner. Timing verdicts require a change beyond the combined margin of error (at least 5%) and one 0.1ms timer tick, with the fastest sample also moving beyond that margin. Workflow run

js-framework: 1k/10k row operations (ms, lower is better)

All 20 timed operations (20 within noise)
target operation base head Δ noise
octane-tsrx run 3.67 3.37 −8.2% ±29% ⚪ within noise
octane-tsrx replace 7.05 7.06 +0.1% ±12% ⚪ within noise
octane-tsrx add 3.28 3.33 +1.5% ±11% ⚪ within noise
octane-tsrx update 0.36 0.38 +5.6% ±34% ⚪ within noise
octane-tsrx select 0.16 0.16 +0.0% ±99% ⚪ within noise
octane-tsrx swap 0.31 0.39 +25.8% ±32% ⚪ within noise
octane-tsrx remove 0.37 0.38 +2.7% ±33% ⚪ within noise
octane-tsrx runlots 31.44 29.91 −4.9% ±29% ⚪ within noise
octane-tsrx select_lots 0.21 0.23 +9.5% ±52% ⚪ within noise
octane-tsrx clear 40.59 41.64 +2.6% ±8% ⚪ within noise
octane-jsx run 3.45 3.56 +3.2% ±6% ⚪ within noise
octane-jsx replace 6.53 7.18 +10.0% ±19% ⚪ within noise
octane-jsx add 3.10 3.32 +7.1% ±16% ⚪ within noise
octane-jsx update 0.48 0.56 +16.7% ±41% ⚪ within noise
octane-jsx select 0.35 0.38 +8.6% ±37% ⚪ within noise
octane-jsx swap 0.59 0.68 +15.3% ±28% ⚪ within noise
octane-jsx remove 0.53 0.58 +9.4% ±36% ⚪ within noise
octane-jsx runlots 27.55 28.26 +2.6% ±6% ⚪ within noise
octane-jsx select_lots 2.20 2.24 +1.8% ±18% ⚪ within noise
octane-jsx clear 41.34 42.61 +3.1% ±11% ⚪ within noise

Application bundle size (bytes)

No changes across 45 measured values.

Public-import reachability bundles (bytes)

No changes across 105 measured values.

@trueadm
trueadm merged commit f414967 into main Oct 3, 2026
52 checks passed
@trueadm
trueadm deleted the fix/three-frame-bench-callbacks branch October 3, 2026 10:21
trueadm added a commit that referenced this pull request Oct 3, 2026
…nd re-judge them (#1646)

* ci(bench): triage the weekly ratio-guard breaches so new ones show

The weekly Bench job (`bench.mjs --quick --ratios`) was red with 81 ratio
breaches, 4 suites that wrote no numbers and 4 harness gate failures, so a new
breach was invisible. Every item is now a fix or a rebaseline.

- Harness drift, fixed. Each harness had stopped producing numbers when runtime
  source it anchors on changed:
  - ssr-final-replay: a second suspended loop since 2026-09-29.
  - root-transactions/contracts: staged-DOM text and attribute journaling since
    2026-09-15.
  - signal-dom-bindings: a second native style Block allocation site since
    2026-09-23.
  - codegen-size: the server runtime's lazy streamed-signals chunk since
    2026-09-16.
  - recursive-context: counted a pure-call annotation and trailing newlines as
    output growth.
- Rebaselined, with numbers in each note: five cross-framework bundle-size
  ratios and the workerd script-size ratio. The absolute app and server-render
  budgets are now the ratchet. Lynx's no-worklet byte caps from 2026-08-17 are
  reset to measured + 32, with the background program pinned exactly.
- Fix pending, with dated waivers that expire 2026-10-24, each with an owner
  task:
  - three exact counters the revived harnesses exposed (one extra closure per
    ssrTry, 128 live text reads per 128 unchanged compiled updates, compiled
    output at 1.295x its source);
  - Lynx create ratios and the re-entrant transport gate;
  - superlinear hydrate boundary preparation;
  - Octane Three versus R3F size and frame dispatch;
  - two timing regressions near the timer floor;
  - ten quick-mode timing guards whose samples are noise-bound;
  - the scoped descriptor shape change.
- bench.mjs supports a guard `waiver` ({ reason, expires }). A waived breach
  prints and does not fail, and fails again once the date passes.
  HARNESS_FAILURE_ALLOWLIST now also covers a suite whose harness writes no
  numbers.

The budget breaches (57) clear when the budget reset lands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(benchmarks): pair and lengthen the timing samples behind waived ratio guards

Twelve timing guards breached in weekly quick runs without a verdict. Their
samples sat near Chromium's 100 µs clock or under two-sample noise, and each
target ran its whole block minutes after the other side of its guard.

- benchmarks/lib/paired.mjs: rotating per-round visit order and a ~20 ms
  sample calibration shared by the harnesses below.
- js-framework-reorder, memo-wall, svg-dashboard, spa-navigation: every
  target's page stays open in one browser and each sample round visits all
  targets; short ops repeat until a sample takes about 20 ms (clicks,
  hook invocations, op batches, and summed navigation legs).
- activity caught-reveal: a sample reveals several independent hidden roots
  in one window, with the small case revealing eight times as many roots so
  both cases do equal work; the cases alternate per round.
- ssr-workerd: an untimed priming spawn per target, then paired cold-spawn
  rounds; quick mode runs six rounds instead of two.
- bench.yml: a `suites` dispatch input to run selected suites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(benchmarks): collect garbage before every timed spa-navigation leg

The untimed return leg mounts a whole route, and its collection landed
inside the next timed teardown: nav_teardown samples ran at 17-45% rme.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(benchmarks): re-judge the twelve waived timing guards with paired samples

Two quick CI runs of the paired, ~20 ms harness and same-runner A/B runs
against the commits that set each guard decided every waiver:

- Passing, waiver removed: activity reports, ssr-workerd
  cold_spawn_to_first_byte, svg-dashboard pan_zoom, memo-wall
  parent_rerender_equal_A and octane-jsx mount, spa-navigation
  nav_teardown and nav_mount (no Octane change since #674 on one runner).
- Rebaselined: svg-dashboard icon_swap 1.2 -> 1.6, because #983's esbuild
  minification made React 15% faster while Octane stayed flat.
- Confirmed Octane regressions, waiver kept and pointed at the fix:
  js-framework-reorder rotateb (1.41x per click since #639), memo-wall
  one_change_B (1.5x) and ctx_through_wall_B (1.44x), and svg-dashboard
  tooltip_swarm (1.31x since #635).
- The rotateb note claimed React moves every survivor; it moves one. A new
  rotatef guard covers the LIS-vs-lastPlacedIndex differentiator (0.043x).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(benchmarks): rebaseline spa-navigation nav_mount to its CI baseline

The 1.2 ceiling came from a local 0.94x reading. On CI runners #674 itself
measures 1.15x and head 1.09-1.16x, so the ceiling left 3% of quick-mode
headroom; 1.35 keeps a margin while still catching per-node mount growth.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): drop the three weekly waivers that now have fix PRs

The waived guards now have owner PRs: ssr-final-replay try_closures (#1644),
root-transactions equal_reads (#1643) and codegen-size gzip compiled/source
(#1645). #1645 rebaselines the same codegen-size entry, so this branch no
longer edits it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): leave lynx-render to its owner fix

The lynx-render transport gate failure and the create_1k/create_10k ratio
breaches both trace to #885's JSON-encoded transport and now have an owner
fix. Its branch re-notes those two guards, so this branch drops their waivers
and the suite's allowlist entry instead of editing the same entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): keep harness failures unwaivable and leave descriptor shapes to their owner

Waiving a suite that throws before it writes numbers would hide any crash in
that suite, not only the known shape change, and skip all of its guards. The
scoped-descriptor-shapes defect has an owner fix in progress. That fix re-pins
the harness's expected keys, so narrowing the waiver here would edit the same
assertion. HARNESS_FAILURE_ALLOWLIST is empty again, and a thrown suite failure
always fails the job. Dated waivers remain only on individual ratio guards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): leave the Three guards to their owner fixes

three-renderer frame_1k_subscribers and the two three-bundle-size ratios have
owner PRs (#1651, #1652) that re-note and ratchet those entries, so this branch
drops their waivers instead of editing the same entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(benchmarks): point the four kept timing waivers at their attributed fixes

rotateb and ctx_through_wall_B clear with #1655 and #1656; one_change_B's
per-row remainder and tooltip_swarm's scoped-descriptor accessor reads each
have their own fix task.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(benchmarks): point parent_rerender_equal_A's note at its per-commit journal fix

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
trueadm added a commit that referenced this pull request Oct 3, 2026
…1641)

* ci(bench): triage the weekly ratio-guard breaches so new ones show

The weekly Bench job (`bench.mjs --quick --ratios`) was red with 81 ratio
breaches, 4 suites that wrote no numbers and 4 harness gate failures, so a new
breach was invisible. Every item is now a fix or a rebaseline.

- Harness drift, fixed. Each harness had stopped producing numbers when runtime
  source it anchors on changed:
  - ssr-final-replay: a second suspended loop since 2026-09-29.
  - root-transactions/contracts: staged-DOM text and attribute journaling since
    2026-09-15.
  - signal-dom-bindings: a second native style Block allocation site since
    2026-09-23.
  - codegen-size: the server runtime's lazy streamed-signals chunk since
    2026-09-16.
  - recursive-context: counted a pure-call annotation and trailing newlines as
    output growth.
- Rebaselined, with numbers in each note: five cross-framework bundle-size
  ratios and the workerd script-size ratio. The absolute app and server-render
  budgets are now the ratchet. Lynx's no-worklet byte caps from 2026-08-17 are
  reset to measured + 32, with the background program pinned exactly.
- Fix pending, with dated waivers that expire 2026-10-24, each with an owner
  task:
  - three exact counters the revived harnesses exposed (one extra closure per
    ssrTry, 128 live text reads per 128 unchanged compiled updates, compiled
    output at 1.295x its source);
  - Lynx create ratios and the re-entrant transport gate;
  - superlinear hydrate boundary preparation;
  - Octane Three versus R3F size and frame dispatch;
  - two timing regressions near the timer floor;
  - ten quick-mode timing guards whose samples are noise-bound;
  - the scoped descriptor shape change.
- bench.mjs supports a guard `waiver` ({ reason, expires }). A waived breach
  prints and does not fail, and fails again once the date passes.
  HARNESS_FAILURE_ALLOWLIST now also covers a suite whose harness writes no
  numbers.

The budget breaches (57) clear when the budget reset lands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): drop the three weekly waivers that now have fix PRs

The waived guards now have owner PRs: ssr-final-replay try_closures (#1644),
root-transactions equal_reads (#1643) and codegen-size gzip compiled/source
(#1645). #1645 rebaselines the same codegen-size entry, so this branch no
longer edits it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): leave lynx-render to its owner fix

The lynx-render transport gate failure and the create_1k/create_10k ratio
breaches both trace to #885's JSON-encoded transport and now have an owner
fix. Its branch re-notes those two guards, so this branch drops their waivers
and the suite's allowlist entry instead of editing the same entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): keep harness failures unwaivable and leave descriptor shapes to their owner

Waiving a suite that throws before it writes numbers would hide any crash in
that suite, not only the known shape change, and skip all of its guards. The
scoped-descriptor-shapes defect has an owner fix in progress. That fix re-pins
the harness's expected keys, so narrowing the waiver here would edit the same
assertion. HARNESS_FAILURE_ALLOWLIST is empty again, and a thrown suite failure
always fails the job. Dated waivers remain only on individual ratio guards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): leave the Three guards to their owner fixes

three-renderer frame_1k_subscribers and the two three-bundle-size ratios have
owner PRs (#1651, #1652) that re-note and ratchet those entries, so this branch
drops their waivers instead of editing the same entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant