Repository navigation
perf(octane): ship universal host bindings and template programs only to renderers that use them - #1652
Merged
Conversation
… to renderers that use them Weekly Bench's three-bundle-size guards breached at 1.059x (minimal) and 1.042x (full catalogue) of React Three Fiber. Since #677, octane-min grew 15.6 KB gzip, almost all of it in universal-core.ts (131 KB -> 178 KB minified). The largest additions were Lynx-only template paths (#693, #700, #716, #750) and opt-in host bindings (#1044). @octanejs/three itself was flat. - universalHostBinding() now installs the subscription, flush, and binding-only transaction code on its first call. The root keeps one lazy binding state instead of seven eager fields, and commits skip the per-host binding loops when no binding can exist. - Template programs are a driver opt-in: templateProgramMount, templateProgramRuns, and collapsedTemplateMount take effect only with `templates: universalHostTemplates`. The Lynx background driver passes it. Program preparation, collapsed-template materialization and expansion, and the compact template update now sit behind that object. octane-min 199019 -> 193811 gzip (1.031x), octane-full 260746 -> 255569 (1.021x). The guards ratchet to 1.034 and 1.024; reaching 1.0 needs a broader universal-core diet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
5 of 6 tasks
Contributor
Benchmark report🟢 No size increases and no timing regressions outside noise. Compares js-framework: 1k/10k row operations (ms, lower is better)All 20 timed operations (20 within noise)
Application bundle size (bytes)No changes across 45 measured values. Public-import reachability bundles (bytes)No changes across 105 measured values. |
The changeset check rejects a changeset that mixes the ignored private @octanejs/lynx package with octane. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
6 of 7 tasks
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]>
This was referenced Oct 4, 2026
trueadm
added a commit
that referenced
this pull request
Oct 4, 2026
… (#1710) #1700 freezes a fresh root's decoded program runs so a first mount takes the dense host record store again. That costs the main thread 141 raw bytes: preview main gzip 83,657 -> 83,742 and IFR 89,331 -> 89,404, both over their measured + 32 caps. The weekly-only lynx-bundle-size gate never ran on that pull request. Raise both caps to the new measurement + 32. Re-pin the background program at 288,390: it shrank after the 2026-10-03 reset (#1652, #1662), and its exact pin is the next gate in the same block. Budget values and their comment only. Refs #1055 Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The weekly Bench's
three-bundle-sizeguards breach React Three Fiber: octane-min is 1.059× and octane-full 1.042×. This PR removes Lynx-only and opt-in code from every Three bundle and ratchets both guards to the new measured ratio.Where the bytes went. I rebuilt the #677 entry (fc1c146, when the guard passed by 4.5 KB) with today's toolchain and attributed by module and declaration.
universal-core.ts, which went from 131 KB to 178 KB minified.@octanejs/threeis flat, and the DOM runtime contributes about 1.3 KB to the Three bundle. The in-flight hydration-capability and retired-event-host work therefore won't move this guard.Changes
universalHostBinding()sets a module-level support slot. That slot holds the subscription, flush, and binding-only transaction code: the formerdropHostBindings…flushHostBindingUpdatesmethods plusUniversalBoundHostTransaction.UniversalHostDriver.templatestakes the newuniversalHostTemplatesexport.templateProgramMount,templateProgramRuns, andcollapsedTemplateMountcapabilities take effect only with it. Without it, those trees mount and update through ordinary host commands.tryCreateCompactTemplateUpdateTransaction.UniversalRootImpl(not exported) dropsprivateon the members these module-level supports read.Evidence
node benchmarks/three/run-size.mjs, same machine, every bundle scene-checked in Chromium:Universal-core in the Three bundle drops from 177.9 KB to 158.1 KB minified.
Runtime A/B, same worktree, interleaved, main core vs this core:
update_1k0.988×,mount_1k1.008×,reorder_1k0.973× (noise).Validation
pnpm format:files:check,pnpm synccleanpnpm typecheck:fileson the changed sourcespnpm test(not run in full locally, to keep machine load down; CI runs it)octaneproject: universal-host-sdk, universal-renderer, universal-host-bindings, universal-host-binding-retention, universal-effect-retention, and universal-native (all pass).lynxproject: 29 files, 404 tests. Removingtemplatesfrom the Lynx client driver fails a Lynx test, so the opt-in is covered.mount-template-run).universal-template-eventsanduniversal-prop-shapesbenchmarks pass their semantic checks.Risk / follow-ups
templates: universalHostTemplates. Without it, those trees fall back to ordinary commands. Output is correct but unoptimized. Documented in the changeset anddocs/universal-renderer-architecture.md.createPreparedTransaction.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches universal root commit, transaction, and driver contract (new required opt-in for template-program optimization); behavior is preserved via fallbacks but misconfigured drivers lose compact template paths.
Overview
Universal renderers no longer always pay for experimental host bindings or template-program machinery. The first
universalHostBinding()call installs subscription, flush, and binding-only transaction support; roots that never create bindings skip that code path while behavior stays the same.Template programs are opt-in per driver via a new
templates: universalHostTemplatesfield onUniversalHostDriver.templateProgramMount,templateProgramRuns, andcollapsedTemplateMountonly activate when that export is supplied; otherwise keyed/program-capable trees mount and update through ordinary host commands. The Lynx background driver opts in; Three does not, shrinking typical production bundles by ~5.2 KB gzip.Benchmark ratchets for
three-bundle-sizemove from 1.0× to the measured R3F ratios (minimal ~1.031×, full ~1.021×), with docs/changeset notes that third-party drivers declaring template capabilities must now passuniversalHostTemplatesor accept the unoptimized fallback.Reviewed by Cursor Bugbot for commit bd5ba29. Bugbot is set up for automated code reviews on this repo. Configure here.