Skip to content

test(bench): add an app-shell bundle-size set with a React + alien-signals twin - #2027

Merged
trueadm merged 1 commit into
mainfrom
test/bundle-size-app-shell
Oct 13, 2026
Merged

trueadm merged 1 commit into
mainfrom
test/bundle-size-app-shell

Conversation

@o-alexandrov

@o-alexandrov o-alexandrov commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds a shell_* set to benchmarks/bundle-size/run.mjs. It is the smallest app that combines the runtime features a production Octane app uses together, plus a React 19.3 + alien-signals twin of the same component.
  • Requested in Reduce client runtime bundle size while preserving the API #1801 (comment): an example app that shows the bundle-size issue, compared against React with alien-signals.

Why

Each existing fixture uses one or two features, so it reaches only a small part of the runtime. Production apps use hydration, lazy routes, Suspense, ViewTransition, transitions, and signals together. The whole app is one component (a useSignal$ counter inside ViewTransition, updated in startTransition), one lazy page under Suspense, and a hydrateRoot entry. It has under 1 kB of app code, so almost every byte measured is runtime.

Local result (Vite 8, oxc minify, gzip):

target total app framework
shell_ octane-jsx 124,977 767 124,210
shell_ react 19.3 + alien-signals 70,566 805 69,761

Knockout on both twins, swapping the same feature in each (total gzip):

swapped Octane React 19.3
none 124,658 70,330
hydrateRoot → createRoot 101,408 (−23,250) 70,270 (−60)
ViewTransition → Fragment 105,496 (−19,162) 70,326 (−4)
signals → useState (useSignal$ / alien-signals) 109,609 (−15,049) 68,850 (−1,480)
lazy + Suspense → static import + Fragment 113,302 (−11,356) 69,647 (−683)
all four 58,156 (−66,502) 68,104 (−2,226)

React ships these features in its base runtime, so removing them saves it about 2.2 kB. Octane splits each one out, so the base is 10 kB smaller than React's, but each feature adds 11 to 23 kB and the costs add up. With the four features combined, Octane ships 54.3 kB more than React. Without signals on either side (React with useState, Octane with useState but keeping the other three features), it is 109.6 kB against 68.9 kB.

Changes

  • benchmarks/bundle-size/apps/app-shell/{octane-jsx,react}: the two twins, each with main.tsx, app.tsx, and page.tsx.
  • run.mjs: new APP_SHELL set with prefix shell_ and ceiling: false, so the signal and alien-signals imports don't widen the rows ceilings.
  • pnpm-workspace.yaml: both twins are workspace packages. The React twin pins react/react-dom 19.3.0, the first stable release with <ViewTransition>, because the default catalog is on 19.2. It also bumps the hoisted react peer that a few docs/tsrx tooling snapshots resolve, which is lockfile-only, like weather-app/*, so adding React doesn't re-resolve @apollo/client peers in the bindings app.
  • benchmarks/README.md, size-review.mjs: document the shell_ prefix.
  • pnpm sync output: lockfile hashes in packages/*/audit/react-parity.json and the evals manifest.

Validation

  • node benchmarks/bundle-size/run.mjs octane-jsx react: exits 0, numbers above
  • octane-tsc strict on the Octane twin: clean
  • node --test benchmarks/size-review.test.mjs scripts/bundle-size-workflow.test.mjs: 22/22 pass (first revision; the harness hasn't changed since)
  • pnpm format:files on the changed paths, pnpm sync
  • pnpm typecheck / pnpm test: not run locally. No runtime or compiler source changed.
  • perf-review: not applicable (benchmark fixture only)
  • concise-code: 3 source files per twin, about 40 lines each. I didn't extend weather-app, because that would change the existing rows. I didn't add per-feature run-minimal.mjs scenarios either, because those already gate each feature on its own, and the gap only shows up when the features are combined.

Risk / follow-ups

  • The React twin isn't typechecked, which matches the other React benchmark fixtures (no @types/react).
  • octane-jsx reports void-root generic-root for this set. That's informational: only octane-tsrx is gated on it.
  • No baseline file is updated. The CI bench report will show the new shell_* rows as additions.

Provenance

  • An agent produced this diff (agent-authored)

Note

Low Risk
Benchmark and documentation only; React 19.3 is scoped to the new fixture via lockfile, not production Octane packages.

Overview
Adds a shell_* bundle-size scenario that measures runtime cost when production-style features are combined, not in isolation.

New twin apps under benchmarks/bundle-size/apps/app-shell/ share the same UI: hydrateRoot, a lazy route behind Suspense, ViewTransition, startTransition, and a counter driven by useSignal$ (Octane) or alien-signals + useSyncExternalStore (React). The Octane target uses octane-jsx; the React twin pins React 19.3.0 so <ViewTransition> is available.

run.mjs registers the set with prefix shell_, targets octane-jsx and react, and ceiling: false so signal-related imports do not inflate framework ceiling rows. pnpm-workspace.yaml lists both packages; benchmarks/README.md and size-review.mjs document the shell_ prefix.

Lockfile sync adds the workspace entries and bumps lockfileSha256 across react-parity.json audit files (no runtime/compiler changes).

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

@o-alexandrov
o-alexandrov marked this pull request as ready for review October 12, 2026 20:48
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent test PR: tests only labels Oct 12, 2026
@o-alexandrov
o-alexandrov requested review from trueadm and removed request for trueadm October 12, 2026 20:49
@o-alexandrov
o-alexandrov marked this pull request as draft October 12, 2026 20:52
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 12, 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 Updated (UTC)
⚠️ Deployment skipped
View logs
octane-website faa03e1 Oct 12 2026, 09:13 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 12, 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 Updated (UTC)
⚠️ Deployment skipped
View logs
octane-website-mcp faa03e1 Oct 12 2026, 09:13 PM

@o-alexandrov
o-alexandrov force-pushed the test/bundle-size-app-shell branch from 1f5e2c4 to 1fb43ab Compare October 12, 2026 21:01
@o-alexandrov
o-alexandrov marked this pull request as ready for review October 12, 2026 21:02
@o-alexandrov
o-alexandrov force-pushed the test/bundle-size-app-shell branch from 1fb43ab to faa03e1 Compare October 12, 2026 21:13
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares b826221fc, the merge commit's first parent with 2cbc38768 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 3.033 3.308 +4.4% −3.3% … +11.0% ⚪ within noise
octane-tsrx replace 9.325 9.792 +4.8% +1.1% … +7.8% ⚪ within noise
octane-tsrx add 2.900 2.867 ±0.0% −6.8% … +3.8% ⚪ within noise
octane-tsrx update 0.160 0.165 +4.1% −0.6% … +7.6% ⚪ within noise
octane-tsrx select 0.006 0.006 −0.3% −2.8% … +4.7% ⚪ within noise
octane-tsrx swap 0.021 0.021 +1.7% +0.3% … +3.9% ⚪ within noise
octane-tsrx remove 0.020 0.018 −0.7% −5.1% … +1.1% ⚪ within noise
octane-tsrx runlots 29.442 30.758 −1.0% −7.6% … +5.3% ⚪ within noise
octane-tsrx select_lots 0.007 0.007 +0.0% −1.7% … +1.1% ⚪ within noise
octane-tsrx clear 56.792 60.983 +4.2% −3.0% … +8.0% ⚪ within noise
octane-jsx run 4.633 4.650 −2.2% −13.3% … +8.4% ⚪ within noise
octane-jsx replace 10.558 10.900 +2.5% −7.2% … +10.5% ⚪ within noise
octane-jsx add 3.733 3.967 +5.6% ±0.0% … +14.0% ⚪ within noise
octane-jsx update 0.329 0.310 −4.1% −8.5% … +3.3% ⚪ within noise
octane-jsx select 0.171 0.179 +1.7% −2.3% … +8.3% ⚪ within noise
octane-jsx swap 0.245 0.257 +3.4% −2.0% … +5.8% ⚪ within noise
octane-jsx remove 0.225 0.228 +0.5% −1.1% … +5.1% ⚪ within noise
octane-jsx runlots 33.042 33.658 +1.6% −1.6% … +4.9% ⚪ within noise
octane-jsx select_lots 1.702 1.596 +1.0% −5.8% … +3.9% ⚪ within noise
octane-jsx clear 74.808 74.792 +5.0% −4.7% … +22.5% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-jsx shell_js_raw – 398,545 – 🆕
octane-jsx shell_js_gzip – 124,977 – 🆕
octane-jsx shell_js_brotli – 106,469 – 🆕
octane-jsx shell_app_raw – 1,093 – 🆕
octane-jsx shell_app_gzip – 767 – 🆕
octane-jsx shell_app_brotli – 657 – 🆕
octane-jsx shell_fw_raw – 397,452 – 🆕
octane-jsx shell_fw_gzip – 124,210 – 🆕
octane-jsx shell_fw_brotli – 105,812 – 🆕

75 other measured values are unchanged.

Public-import reachability bundles (bytes)

No changes across 111 measured values.

@trueadm

trueadm commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

The shell under a split-chunk rolldown + oxc build

These are measurements to keep alongside the shell_ set. A production rolldown + oxc app ships Octane differently from this set's single bundle: ESM chunks, with codeSplitting (or the older advancedChunks or manualChunks) groups that put the runtime and the signals engine in chunks of their own. #2032 adds that shape to bundle-reachability as split-shell. It is an SSR shell hydrated through a dynamic import, with a renderer-free behavior island, native signal reads, <Hydrate when={visible()}>, a lazy route behind useTransition, @try over use(), a portal and a keyed list.

row (after #2033) raw gzip
split-shell (all chunks, each compressed separately) 417,861 133,510
split-shell-runtime 331,940 105,346
split-shell-signals 76,233 23,530

Do the #1855 / #1942 eliminations survive oxc and split chunks?

Yes. I built the same app with static imports two ways and compared them with the source-map oracle:

  • as one IIFE: 419,959 raw;
  • as split ESM chunks: 421,287 raw.

Both keep identical declarations. The 1.3 KB difference is cross-chunk glue, plus oxc not inlining small functions across a chunk boundary.

Other checks:

  • Published package vs source: the published dist/ (buildPublishedRuntime) builds within 10 B of source.
  • Profiling define: __OCTANE_PROFILE_ENABLED__ comes from the Vite plugin, so a build without a manual define is byte-identical.
  • Annotations and chunk boundaries: /* @__PURE__ */, #__NO_SIDE_EFFECTS__ and exports between chunks remove nothing differently from a single bundle.

Chunk totals depend on the chunking config

Compare per module through the source map, not per chunk:

  • A manualChunks function assigns about 13.5 KB of signal modules to the runtime chunk instead of the signals chunk. Its dependency capture follows runtime.ts's imports.
  • With codeSplitting groups, an entry that imports octane/signals/client makes the signals group swallow the whole runtime.
  • codeSplitting: false on an app with dynamic imports wraps every module in __esmMin lazy initializers, adding about 18 KB. It is not a valid baseline.

Did the signals engine grow between 0.10.2 and 0.13.1?

No. I built the same shell against both npm releases, each with its own compiler:

chunk config chunk 0.10.2 0.13.1
codeSplitting groups runtime 345,971 335,553
codeSplitting groups signals 80,054 76,312
manualChunks signals 49,000 44,673
with a vendor group signals 78,260 76,312

Per module, signals/* plus alien-signals went from 76.6 KB to 72.2 KB. The vendored graph (#1986) is a move: graph.js grew 1,270 B and alien-signals/esm/system.mjs (1,866 B) dropped out, for a net −0.6 KB. Over the same range engine.js lost 3,363 B and runtime.js lost 9,758 B. A chunk-total jump between those releases comes from how the config assigns modules to chunks, or from changes in the app, not from engine growth.

Where the signals chunk's never-run bytes go

At hydrate, 27% of the signals chunk executes. The largest never-run pieces are:

  • SignalActionFrame: 8.6 KB
  • DerivedBinding: 7.1 KB, 11% executed
  • createSignalTransitionCoordinator: 5.1 KB
  • adoption and seed decoding: about 5 KB
  • server seed serialization (serializeScopeRead + scopeSeedEntry + encodeSignalValue): about 2.1 KB, kept only because serializeRead was a ScopeImpl method

#2035 measured removing that method at −2,134 raw / −486 gzip on the signals chunk. It is paused as evidence for #2031 item E.

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 test PR: tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants