Skip to content

perf(octane): let Vite's minifier drop unused optional drivers - #1942

Merged
trueadm merged 2 commits into
mainfrom
perf/foldable-driver-reads
Oct 9, 2026
Merged

trueadm merged 2 commits into
mainfrom
perf/foldable-driver-reads

Conversation

@trueadm

@trueadm trueadm commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Vite applications that never use an optional capability (ViewTransition, native signal reads, Activity and Suspense visibility, deferred layout, transition swaps, form actions) now ship none of its code. Framework gzip drops 2.6 kB on the js-framework rows app (−7.5%), 3.0 kB on TodoMVC, and 2.1–3.8 kB on every Vite scenario in run-minimal. Behavior is unchanged.

Why the code stayed

Vite 8 forces Rolldown's output.topLevelVar = true, so every top-level let in runtime.ts ships as var. A var can be read before its initializer runs, so oxc only knows a never-assigned driver is "its initializer or undefined". It therefore folds a test only when both values agree on the result (truthiness), and only when the declaration sits above the reader. I confirmed this with a repro on the repo's Vite 8.1.5 / Rolldown 1.1.5 (statements before the declaration are globalThis.a = new WeakMap()):

Read of a never-assigned var D = null Folds?
if (D), D && D.f(), D ? D.f() : x, !D yes
D !== null, D === null, D != null no
D?.f(), D?.f() ?? x no
const d = D; if (d) (plain local copy) no
const d = D ? D : null yes
any read above the declaration no
var D; (no initializer) no

The earlier audit's prototype gated each read with a separate false boolean. That works for the same reason, but it doubles the state per driver. Reading the driver itself by truthiness folds just as well, with no new variables and nothing to keep in sync.

Changes

  • runtime.ts: declare the optional drivers and stages (STAGED_DOM, the transition, ViewTransition, visibility and deferred-layout drivers, STAGED_COMMIT_CAPTURE, FORM_SUBMIT_DRIVER, activityRefState, EFFECT_RECONNECT_CONTEXT) in one block above every reader. A comment there states the rule.
  • Read each driver by truthiness. The 893 STAGED_DOM?.view(x) ?? x receivers become STAGED_DOM ? STAGED_DOM.view(x) : x. That is exact, because DOMStage.view returns its argument or a proxy and never nullish. The rewrite was mechanical (AST codemod plus prettier), and most of the runtime line count is that rewrite and its reflow. Other forms: D?.m() === true → D && D.m() (each such method returns boolean); D?.m() ?? d → D ? D.m() : d where m never returns nullish (splitCue can, so it keeps its ?? renderBlock); const d = D; if (d === null) return → if (!D) return; const d = D.
  • Local copies that are semantically needed, because a render can install the driver mid-iteration (transitionRoot, swapDriver ×4), are written D ? D : null. Copies of drivers that are installed once and never cleared (visibility, ViewTransition flush) read the global instead.
  • scripts/check-staged-dom.mjs now accepts only the foldable receiver STAGED_DOM ? STAGED_DOM.view(x) : x, so STAGED_DOM?.view(x) ?? x and STAGED_DOM !== null ? … are rejected. Fixtures are updated.
  • New packages/octane/tests/optional-driver-bundle.test.ts: two real Vite production builds (default oxc minifier, runtime bundled from source), checked with the existing source-map oracle from hydration-free-gates.mjs. A plain list app retains none of nine optional declarations. An app using ViewTransition, Suspense, Activity and signals retains all nine, which proves the oracle can see each one. Both minified bundles then run (render, click, unmount), so the folded code is executed, not only measured.
  • benchmarks/bundle-size/hydration-free-gates.d.mts: types for the gate helpers the test imports, following benchmarks/lib/dom-nodes.d.mts.
  • benchmarks/root-transactions/contracts.mjs: its journalAttr patch string now uses the new receiver spelling.
  • octane-core-extend skill: one line on the driver read form, so the next change doesn't reintroduce D !== null. RuleSync copies regenerated.

Validation

  • pnpm format:check: not run repo-wide; pnpm format:files:check on every changed file passes

  • pnpm typecheck: not run repo-wide; pnpm typecheck:files packages/octane/src/runtime.ts packages/octane/tests/optional-driver-bundle.test.ts passes

  • pnpm test: left to CI

  • targeted tests:

    • New test: 2/2 in octane and octane-prod. On main's runtime.ts the plain-app case fails, with all nine declarations retained. Reverting one reached read (getFirstChild's if (STAGED_DOM) → !== null) fails it with expected [ 'STAGED_DOM' ] to deeply equal [].
    • All of tests/hydration/ in octane + octane-prod: 332 file runs, 16,022 tests pass.
    • Owning feature files in octane + octane-prod (every view-transition*, activity*, suspense*, transition*, form-action*, native-*, ref*, deferred*, manual-hook*, warm-plan* file and the new test), on head 5df7e8e: 102 file runs, 1,586 tests pass. Correction: my first run of these files never executed. zsh didn't split the file list I passed, so only tests/hydration/ ran, and the earlier version of this line claimed results I didn't have. The review caught a dangling else that view-transition-staging.test.ts detects; it is fixed in 5df7e8e (see Risk).
    • octane-signals-prod, full project: 25 files, 333 tests pass. signals-native* in octane-signals + octane-signals-prod: 6 files, 50 tests pass.
    • node scripts/check-staged-dom.mjs is clean; node --test scripts/check-staged-dom.test.mjs 9/9; node --test benchmarks/bundle-size/hydration-free-gates.test.mjs 11/11.
  • Work counters: node benchmarks/js-framework/pair.mjs --base-tree=<origin/main 4f82777bbd worktree> --work-only. All 40 calls_* / dom_* counters are identical for octane-tsrx and octane-jsx (for example calls_run 25,087 → 25,087, calls_runlots 250,084 → 250,084, dom_clear 10,004 → 10,004). These fixtures build with minify: 'esbuild', which never folds, so this shows the rewritten reads add no work. The folded oxc bundle is what the new test executes.

  • Bytes, base origin/main 4f82777 vs head, same machine and commands.

    node benchmarks/bundle-size/run.mjs octane-tsrx octane-jsx, framework chunk:

    Fixture raw gzip brotli
    rows (tsrx) 106,888 → 98,006 (−8,882) 34,883 → 32,283 (−2,600, −7.5%) 30,947 → 28,795 (−2,152)
    rows (jsx) 180,410 → 164,680 (−15,730) 57,126 → 53,229 (−3,897) 49,787 → 46,656 (−3,131)
    TodoMVC 118,920 → 107,548 (−11,372) 38,276 → 35,280 (−2,996) 33,757 → 31,335 (−2,422)
    chat-stream 116,523 → 105,746 (−10,777) 37,617 → 34,666 (−2,951) 33,196 → 30,867 (−2,329)
    weather-app 136,739 → 123,333 (−13,406) 43,807 → 40,113 (−3,694) 38,470 → 35,543 (−2,927)
    bindings 345,202 → 330,650 (−14,552) 110,815 → 107,673 (−3,142) 96,298 → 93,821 (−2,477)
    full-API ceiling 573,260 → 572,873 (−387) 173,065 → 173,084 (+19) 145,583 → 145,452 (−131)

    App chunks change only by +1–7 B (gzip/brotli) from cross-chunk import renaming; app source and compiler output are unchanged. The CI benchmark report matches these rows, and all 64 work counters are unchanged.

    node benchmarks/bundle-size/run-minimal.mjs, gzip: every Vite runtime scenario drops 2,150–3,818 B, for example root-static-specialized 24,085 → 21,935, root-static 52,694 → 48,876, hooks-state 28,313 → 25,973, hydrate-root 44,500 → 42,093, suspense-transition 45,649 → 43,441, binding-radix-vite 64,385 → 61,604. The esbuild scenarios grow 19–30 B (for example binding-radix-esbuild +19, binding-usehooks-ts-esbuild +30). Server, capture-only, behavior-root and isolated binding scenarios are unchanged.

  • perf-review: node scripts/perf-review-scan.mjs → 4 candidates, all dismissed. Hot paths touched: renderBlock (per render: NATIVE_READ_DRIVER begin/end and the urgentTransitionDriver test), the drain loop (per queued block: visibility find, splitCue, transition attempt), event dispatch (per event: pauseLifecycle), and DOM helpers (per node: staged receivers). Each read keeps the same work. X?.m() becomes if (X) X.m(), and X !== null becomes a truthiness test of the same object-or-null value. urgentTransitionDriver gains a leading driver test that short-circuits first when transitions are unused. No new fields, allocations, closures, DOM operations or scheduling, and the pair.mjs counters above are identical.

    # Severity Location Dimension Finding Evidence Provided?
    1 note packages/octane/src/runtime.ts (runtime-wide) bundle Truthiness forms are 1–2 B longer than ?. where nothing folds: esbuild users +19–30 B gzip, full-API ceiling +19 B run.mjs / run-minimal.mjs rows above yes

    Dismissed candidates:

    • packages/octane/src/runtime.ts:9009-9010, 9146-9147 [layout-read]: existing focus-restore scrollLeft/scrollTop reads. Only the receiver spelling changed (STAGED_DOM?.view(x) ?? x → ternary); order and phase are unchanged.
  • concise-code: src +1,494 −1,157 (runtime +1,494 −1,157). 895 of the added runtime lines are the mechanical STAGED_DOM ternary, and most of the rest is prettier reflow of those lines. New files: the test, which is the regression the change needs, and hydration-free-gates.d.mts, so the TypeScript test can import the existing oracle. No new exports in shipped code. Alternatives considered:

    • The prototype's per-driver false gates: the same number of read-site edits, plus about 14 gate variables and writes at each installer, a second piece of state per driver.
    • A shared stagedView(x) helper for the 893 receivers: a few lines of diff, but oxc does not inline the folded identity function, which leaves about 158 calls in the rows bundle, and it puts a call back on every host operation (the runtime comment rules that out).
    • Setting topLevelVar: false from the Vite plugin: no source change, but it changes TDZ semantics and costs for the whole application, not Octane's to choose.
    • Renaming STAGED_DOM to something shorter to avoid reflow: gratuitous churn.
      Bytes: the rows above.

Risk / follow-ups

  • Fixed after review (5df7e8e): rewriting if (inFlush) A?.f(o); else B?.g(o); as if (inFlush) if (A) A.f(o); else … bound the else to the inner if. Outside a flush, a same-component root.render() then skipped refreshing the pending ViewTransition receipt. The outer branch is now braced, and the five other if (cond) if (D) statements are flattened to if (D && cond) (each condition is side-effect free). An AST scan of main's source finds no other optional-call statement that was the then-branch of an if … else, and none of these nested ifs remain.

  • Regression guard is partial by design. The new test fails if a reached read of any listed declaration stops folding, and the staged-DOM checker rejects non-folding receivers. A new driver, or a read in a path neither fixture reaches, still relies on the runtime comment and the skill line.

  • Deliberately left: TRANSITION_ROOT_DRIVER / TRANSITION_TASK_DRIVER stay in the rows bundle (about 30–40 B gzip each). Their remaining reads are guarded by owner.transition !== undefined or TRANSITION_QUEUE.length !== 0, which imply the driver is installed. Folding them needs an extra driver test at each site. The rest of the leftovers live outside runtime.ts (installedEnvironment, signalOwnerFrame, hiddenTextWriter) and are under 40 B each.

  • Existing breakage, not from this PR: benchmarks/root-transactions/contracts.mjs's journalText patch string already matches nothing on main, because that call now passes a precomputed previous. The root-transactions audit throws before it reaches the journalAttr string updated here.

  • The esbuild +19–30 B and ceiling +19 B are the cost of the longer forms in bundles that cannot fold. They are reported, not gated.

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

Medium Risk
Touches pervasive hot-path runtime reads (staged DOM receivers, driver gates) across runtime.ts; behavior is intended to be equivalent but regression coverage is partial for drivers not exercised by the new fixtures.

Overview
Apps that never use optional capabilities (ViewTransition, Activity/Suspense visibility, native signal reads, staged DOM, etc.) can now ship less runtime after a Vite production build. Optional module-level drivers are declared above their readers and guarded with truthiness checks (if (D), D ? D.f() : x) instead of D !== null, D?.f(), or STAGED_DOM?.view(x) ?? x, so oxc can fold never-installed drivers and drop the code behind them.

The bulk of the diff is the mechanical STAGED_DOM ? STAGED_DOM.view(node) : node receiver rewrite across the runtime, plus check-staged-dom enforcement and updated fixtures. A new optional-driver-bundle.test.ts runs real Vite production builds and uses the hydration-free source-map oracle to assert optional declarations are absent in a plain app and retained when ViewTransition, Suspense, Activity, and signals are used; both bundles are executed to confirm behavior is unchanged.

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

Vite 8 emits top-level `let` as `var` (Rolldown's `topLevelVar`). A `var`
can be read before its initializer runs, so oxc only knows a never-assigned
driver is "null or undefined" and folds only truthiness tests of it, and only
when the declaration precedes every reader. `D !== null`, `D?.f()`, and plain
local copies kept every optional capability's call sites in every bundle,
including the 893 `STAGED_DOM?.view(x) ?? x` reads of ViewTransition's stage.

Declare the optional drivers and stages above their readers and read them by
truthiness (`D ? D.view(x) : x`, `D && D.f()`, `if (!D) return`, a needed local
copy as `D ? D : null`). Applications that never install ViewTransition,
native reads, Activity visibility, deferred layout, transition swaps, or form
actions now ship none of that code: framework gzip drops 2.6 kB on the
js-framework rows app, 3.0 kB on TodoMVC, and 3.7 kB on the weather app.

The staged-DOM boundary check now accepts only the foldable receiver form, and
a production Vite build test proves both directions: a plain app retains none
of the driver declarations, and an app using each capability retains them all.

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 perf PR: performance work labels Oct 9, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website 5df7e8e Commit Preview URL

Branch Preview URL
Oct 09 2026, 05:11 PM

@trueadm
trueadm marked this pull request as ready for review October 9, 2026 16:50
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp 5df7e8e Commit Preview URL

Branch Preview URL
Oct 09 2026, 05:13 PM

@domgan-oai domgan-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minifier-facing change is well targeted: it enables removal of unused capabilities without adding helper calls or duplicate driver state. I found one correctness regression in the optional-call rewrite, detailed inline. Using the existing view-transition-staging tests with production compilation, all three focused scenarios pass on the base, fail with this exact head's runtime, and pass with the outer inFlush branches braced.

Comment thread packages/octane/src/runtime.ts Resolved
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 9 value(s) increased
  • 🔴 bundle-reachability: 8 value(s) increased

Compares 4f82777bb, the merge commit's first parent with bcd202f08 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 5.142 4.925 −0.0% −3.0% … +8.5% ⚪ within noise
octane-tsrx replace 17.050 15.833 −3.7% −18.4% … +6.3% ⚪ within noise
octane-tsrx add 3.358 3.675 −1.7% −5.8% … +7.4% ⚪ within noise
octane-tsrx update 0.208 0.201 −0.2% −3.8% … +3.3% ⚪ within noise
octane-tsrx select 0.008 0.009 −1.0% −6.1% … +9.4% ⚪ within noise
octane-tsrx swap 0.055 0.055 −6.1% −11.4% … +3.4% ⚪ within noise
octane-tsrx remove 0.027 0.027 +0.9% −7.2% … +8.2% ⚪ within noise
octane-tsrx runlots 41.633 39.842 −0.1% −7.5% … +4.0% ⚪ within noise
octane-tsrx select_lots 0.010 0.010 −1.4% −7.6% … +11.2% ⚪ within noise
octane-tsrx clear 96.217 95.450 −2.9% −7.2% … +4.0% ⚪ within noise
octane-jsx run 5.942 5.925 −1.9% −10.8% … +5.4% ⚪ within noise
octane-jsx replace 15.417 15.333 +2.5% −7.7% … +9.1% ⚪ within noise
octane-jsx add 7.042 7.733 +2.2% −6.0% … +9.8% ⚪ within noise
octane-jsx update 0.499 0.508 +1.1% −6.0% … +4.9% ⚪ within noise
octane-jsx select 0.216 0.191 −3.1% −9.8% … +2.0% ⚪ within noise
octane-jsx swap 0.369 0.365 −2.3% −6.1% … +1.8% ⚪ within noise
octane-jsx remove 0.340 0.369 +0.3% −3.1% … +7.5% ⚪ within noise
octane-jsx runlots 46.317 46.983 −0.9% −6.6% … +7.5% ⚪ within noise
octane-jsx select_lots 2.750 3.237 +6.0% −5.6% … +18.8% ⚪ within noise
octane-jsx clear 95.308 103.525 +0.9% −5.3% … +10.9% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx js_raw 113,836 104,867 −8,969 (−7.9%) 🟢
octane-tsrx js_gzip 37,218 34,608 −2,610 (−7.0%) 🟢
octane-tsrx js_brotli 32,980 30,882 −2,098 (−6.4%) 🟢
octane-tsrx app_gzip 2,335 2,338 +3 (+0.1%) 🔴
octane-tsrx app_brotli 2,033 2,038 +5 (+0.2%) 🔴
octane-tsrx fw_raw 106,888 97,919 −8,969 (−8.4%) 🟢
octane-tsrx fw_gzip 34,883 32,270 −2,613 (−7.5%) 🟢
octane-tsrx fw_brotli 30,947 28,844 −2,103 (−6.8%) 🟢
octane-tsrx todo_js_raw 123,546 112,087 −11,459 (−9.3%) 🟢
octane-tsrx todo_js_gzip 40,497 37,477 −3,020 (−7.5%) 🟢
octane-tsrx todo_js_brotli 35,643 33,179 −2,464 (−6.9%) 🟢
octane-tsrx todo_app_brotli 1,886 1,890 +4 (+0.2%) 🔴
octane-tsrx todo_fw_raw 118,920 107,461 −11,459 (−9.6%) 🟢
octane-tsrx todo_fw_gzip 38,276 35,256 −3,020 (−7.9%) 🟢
octane-tsrx todo_fw_brotli 33,757 31,289 −2,468 (−7.3%) 🟢
octane-tsrx chat_js_raw 122,294 111,430 −10,864 (−8.9%) 🟢
octane-tsrx chat_js_gzip 40,334 37,367 −2,967 (−7.4%) 🟢
octane-tsrx chat_js_brotli 35,583 33,180 −2,403 (−6.8%) 🟢
octane-tsrx chat_app_brotli 2,387 2,385 −2 (−0.1%) 🟢
octane-tsrx chat_fw_raw 116,523 105,659 −10,864 (−9.3%) 🟢
octane-tsrx chat_fw_gzip 37,617 34,650 −2,967 (−7.9%) 🟢
octane-tsrx chat_fw_brotli 33,196 30,795 −2,401 (−7.2%) 🟢
octane-tsrx weather_js_raw 158,915 145,422 −13,493 (−8.5%) 🟢
octane-tsrx weather_js_gzip 51,653 47,942 −3,711 (−7.2%) 🟢
octane-tsrx weather_js_brotli 45,154 42,234 −2,920 (−6.5%) 🟢
octane-tsrx weather_app_brotli 6,684 6,694 +10 (+0.1%) 🔴
octane-tsrx weather_fw_raw 136,739 123,246 −13,493 (−9.9%) 🟢
octane-tsrx weather_fw_gzip 43,807 40,096 −3,711 (−8.5%) 🟢
octane-tsrx weather_fw_brotli 38,470 35,540 −2,930 (−7.6%) 🟢
octane-tsrx bindings_js_raw 692,855 678,276 −14,579 (−2.1%) 🟢
octane-tsrx bindings_js_gzip 226,497 223,351 −3,146 (−1.4%) 🟢
octane-tsrx bindings_js_brotli 192,595 190,119 −2,476 (−1.3%) 🟢
octane-tsrx bindings_app_gzip 115,682 115,683 +1 (+0.0%) 🔴
octane-tsrx bindings_app_brotli 96,297 96,292 −5 (−0.0%) 🟢
octane-tsrx bindings_fw_raw 345,202 330,623 −14,579 (−4.2%) 🟢
octane-tsrx bindings_fw_gzip 110,815 107,668 −3,147 (−2.8%) 🟢
octane-tsrx bindings_fw_brotli 96,298 93,827 −2,471 (−2.6%) 🟢
octane-tsrx full_fw_raw 573,260 572,873 −387 (−0.1%) 🟢
octane-tsrx full_fw_gzip 173,065 173,088 +23 (+0.0%) 🔴
octane-tsrx full_fw_brotli 145,583 145,589 +6 (+0.0%) 🔴
octane-jsx js_raw 188,683 172,865 −15,818 (−8.4%) 🟢
octane-jsx js_gzip 59,985 56,055 −3,930 (−6.6%) 🟢
octane-jsx js_brotli 52,197 49,098 −3,099 (−5.9%) 🟢
octane-jsx app_brotli 2,410 2,408 −2 (−0.1%) 🟢
octane-jsx fw_raw 180,410 164,592 −15,818 (−8.8%) 🟢
octane-jsx fw_gzip 57,126 53,196 −3,930 (−6.9%) 🟢
octane-jsx fw_brotli 49,787 46,690 −3,097 (−6.2%) 🟢
octane-jsx full_fw_raw 573,260 572,873 −387 (−0.1%) 🟢
octane-jsx full_fw_gzip 173,065 173,088 +23 (+0.0%) 🔴
octane-jsx full_fw_brotli 145,583 145,589 +6 (+0.0%) 🔴

10 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
cli-spa-starter raw 102,886 94,386 −8,500 (−8.3%) 🟢
cli-spa-starter gzip 34,367 31,935 −2,432 (−7.1%) 🟢
cli-spa-starter brotli 30,164 28,276 −1,888 (−6.3%) 🟢
root-static-specialized raw 73,089 65,827 −7,262 (−9.9%) 🟢
root-static-specialized gzip 24,085 21,928 −2,157 (−9.0%) 🟢
root-static-specialized brotli 21,532 19,740 −1,792 (−8.3%) 🟢
root-chained-jsx raw 76,110 68,655 −7,455 (−9.8%) 🟢
root-chained-jsx gzip 24,893 22,727 −2,166 (−8.7%) 🟢
root-chained-jsx brotli 22,261 20,446 −1,815 (−8.2%) 🟢
root-static raw 166,428 151,081 −15,347 (−9.2%) 🟢
root-static gzip 52,694 48,871 −3,823 (−7.3%) 🟢
root-static brotli 45,897 42,929 −2,968 (−6.5%) 🟢
root-static-local raw 73,088 65,826 −7,262 (−9.9%) 🟢
root-static-local gzip 24,071 21,915 −2,156 (−9.0%) 🟢
root-static-local brotli 21,538 19,741 −1,797 (−8.3%) 🟢
root-callback-local raw 76,136 68,681 −7,455 (−9.8%) 🟢
root-callback-local gzip 24,901 22,732 −2,169 (−8.7%) 🟢
root-callback-local brotli 22,285 20,465 −1,820 (−8.2%) 🟢
hooks-state raw 85,954 78,003 −7,951 (−9.3%) 🟢
hooks-state gzip 28,313 25,960 −2,353 (−8.3%) 🟢
hooks-state brotli 25,284 23,278 −2,006 (−7.9%) 🟢
prop-attributes raw 86,210 78,184 −8,026 (−9.3%) 🟢
prop-attributes gzip 28,387 25,980 −2,407 (−8.5%) 🟢
prop-attributes brotli 25,363 23,342 −2,021 (−8.0%) 🟢
context raw 97,296 87,147 −10,149 (−10.4%) 🟢
context gzip 31,778 28,852 −2,926 (−9.2%) 🟢
context brotli 28,254 25,835 −2,419 (−8.6%) 🟢
hydrate-root raw 138,763 129,883 −8,880 (−6.4%) 🟢
hydrate-root gzip 44,500 42,087 −2,413 (−5.4%) 🟢
hydrate-root brotli 38,989 36,969 −2,020 (−5.2%) 🟢
deferred-hydration raw 222,120 210,695 −11,425 (−5.1%) 🟢
deferred-hydration gzip 70,094 67,209 −2,885 (−4.1%) 🟢
deferred-hydration brotli 60,445 58,217 −2,228 (−3.7%) 🟢
hydrate-frame raw 368,410 354,926 −13,484 (−3.7%) 🟢
hydrate-frame gzip 114,496 111,911 −2,585 (−2.3%) 🟢
hydrate-frame brotli 97,974 95,938 −2,036 (−2.1%) 🟢
suspense-transition raw 143,942 135,785 −8,157 (−5.7%) 🟢
suspense-transition gzip 45,649 43,443 −2,206 (−4.8%) 🟢
suspense-transition brotli 40,054 38,342 −1,712 (−4.3%) 🟢
component-owned-effects raw 77,449 69,949 −7,500 (−9.7%) 🟢
component-owned-effects gzip 25,394 23,171 −2,223 (−8.8%) 🟢
component-owned-effects brotli 22,748 20,879 −1,869 (−8.2%) 🟢
binding-hooks raw 84,456 76,874 −7,582 (−9.0%) 🟢
binding-hooks gzip 27,976 25,764 −2,212 (−7.9%) 🟢
binding-hooks brotli 25,014 23,199 −1,815 (−7.3%) 🟢
binding-base-ui-vite raw 202,283 190,080 −12,203 (−6.0%) 🟢
binding-base-ui-vite gzip 63,772 61,013 −2,759 (−4.3%) 🟢
binding-base-ui-vite brotli 55,496 53,280 −2,216 (−4.0%) 🟢
binding-base-ui-esbuild raw 217,822 217,709 −113 (−0.1%) 🟢
binding-base-ui-esbuild gzip 70,715 70,741 +26 (+0.0%) 🔴
binding-base-ui-esbuild brotli 61,422 61,446 +24 (+0.0%) 🔴
binding-radix-vite raw 204,355 192,153 −12,202 (−6.0%) 🟢
binding-radix-vite gzip 64,385 61,600 −2,785 (−4.3%) 🟢
binding-radix-vite brotli 55,956 53,873 −2,083 (−3.7%) 🟢
binding-radix-esbuild raw 219,683 219,560 −123 (−0.1%) 🟢
binding-radix-esbuild gzip 71,318 71,342 +24 (+0.0%) 🔴
binding-radix-esbuild brotli 61,877 61,956 +79 (+0.1%) 🔴
binding-mantine-hooks-vite raw 88,051 80,018 −8,033 (−9.1%) 🟢
binding-mantine-hooks-vite gzip 28,967 26,624 −2,343 (−8.1%) 🟢
binding-mantine-hooks-vite brotli 25,863 23,853 −2,010 (−7.8%) 🟢
binding-mantine-hooks-esbuild raw 92,434 92,341 −93 (−0.1%) 🟢
binding-mantine-hooks-esbuild gzip 31,174 31,207 +33 (+0.1%) 🔴
binding-mantine-hooks-esbuild brotli 27,813 27,771 −42 (−0.2%) 🟢
binding-apollo-client-vite raw 344,776 332,232 −12,544 (−3.6%) 🟢
binding-apollo-client-vite gzip 106,083 103,281 −2,802 (−2.6%) 🟢
binding-apollo-client-vite brotli 92,573 90,339 −2,234 (−2.4%) 🟢
binding-apollo-client-esbuild raw 368,010 367,890 −120 (−0.0%) 🟢
binding-apollo-client-esbuild gzip 117,102 117,135 +33 (+0.0%) 🔴
binding-apollo-client-esbuild brotli 102,166 102,268 +102 (+0.1%) 🔴
binding-usehooks-ts-vite raw 88,821 80,800 −8,021 (−9.0%) 🟢
binding-usehooks-ts-vite gzip 29,190 26,843 −2,347 (−8.0%) 🟢
binding-usehooks-ts-vite brotli 26,087 24,115 −1,972 (−7.6%) 🟢
binding-usehooks-ts-esbuild raw 93,208 93,115 −93 (−0.1%) 🟢
binding-usehooks-ts-esbuild gzip 31,408 31,442 +34 (+0.1%) 🔴
binding-usehooks-ts-esbuild brotli 28,020 27,979 −41 (−0.1%) 🟢

36 other measured values are unchanged.

Expanding `if (inFlush) A?.f(o); else B?.g(o);` into truthiness tests made
the `else` bind to the new inner `if (A)`, so outside a flush a same-component
root render skipped refreshing the pending ViewTransition receipt and the
prepared commit was dropped as stale. Brace the outer branch, and flatten the
five other nested `if (cond) if (D)` statements the rewrite produced into
`if (D && cond)` (each condition is side-effect free).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm merged commit 7af43dc into main Oct 9, 2026
59 of 62 checks passed
@trueadm
trueadm deleted the perf/foldable-driver-reads branch October 9, 2026 18:01
@github-actions github-actions Bot mentioned this pull request Oct 9, 2026
trueadm added a commit that referenced this pull request Oct 9, 2026
…udit (#1943)

#1915 renamed setText's text node to `target` and wrapped its journal
call, so contracts.mjs's exact-string instrumentation found no match and
the root-transactions audit threw before measuring anything. Match the
call with a pattern that accepts any spelling of the staged-view read, so
the pending ternary form in #1942 keeps matching too.

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

* test(bench): measure a rolldown + oxc split-chunk shell in bundle-reachability

A production rolldown + oxc app ships Octane as ESM chunks: `codeSplitting`
groups put the signal engine and the rest of the octane package in chunks of
their own, and the renderer loads on a dynamic-import chain. No reachability
fixture built that way, so nothing showed whether the optional-driver
eliminations from #1855 and #1942 survive chunk boundaries, or what each
chunk costs.

The split-shell fixture hydrates a server-rendered shell after activating a
renderer-free behavior island, with native reads of imported signals, a
visible() Hydrate boundary, a lazy route behind useTransition, @Try over
use(), a portal and a keyed list. It reports the whole application and each
group's chunk, rejects Octane modules in application chunks, and checks
through the source map that the runtime chunk drops the unused ViewTransition
and Activity drivers. The chunks run in jsdom linked into one script.

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

* test(bench): resolve the linked split-shell entry without platform paths

linkChunks found the entry chunk through path.relative, which joins with
backslashes on Windows while chunk file names stay POSIX. Pass the virtual
entry id as the link build's input instead.

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

* test(bench): list only each split-shell chunk's modules in its row

The runtime and signals rows measure one chunk each but recorded the whole
application's module list. Each chunk row now carries its own modules; the
behavior snapshot stays on every row because all rows come from the one
verified build.

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 perf PR: performance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants