Skip to content

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

Merged
trueadm merged 4 commits into
mainfrom
test/split-shell-reachability
Oct 13, 2026
Merged

trueadm merged 4 commits into
mainfrom
test/split-shell-reachability

Conversation

@trueadm

@trueadm trueadm commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds a split-shell scenario to bundle-reachability that builds an Octane app the way a production rolldown + oxc app ships it: Vite 8 (Rolldown 1.1.5) with minify: 'oxc', ESM output, and output.codeSplitting groups that put the signal engine (octane-signals-engine) and the rest of the octane package (octane-runtime) in chunks of their own. The renderer loads on a dynamic-import chain.

The shell is a server-rendered app hydrated after a renderer-free octane/behavior island activates. It includes early hydration-event capture, native reads of imported signals, a <Hydrate when={visible()}> boundary, a lazy route behind useTransition, @try over use(), a portal, a controlled input and a keyed @for.

The scenario reports three rows:

  • split-shell: all chunks, each compressed separately.
  • split-shell-runtime: the runtime chunk.
  • split-shell-signals: the signals chunk.

It fails the run when either of these happens:

  • An application chunk contains an Octane module.
  • The runtime chunk keeps the unused ViewTransition and Activity drivers (STAGED_DOM, VIEW_TRANSITION_DRIVER, DEFERRED_LAYOUT_DRIVER, STAGED_COMMIT_CAPTURE, activityRefState, renderHiddenActivity, rehideActivityAfterDescendantRender). The check uses the same source-map oracle as optional-driver-bundle.test.ts, with renderBlockInner as the positive control.

To run the chunks in jsdom, the harness links them into one script as emitted, without minifying or tree-shaking them. That script must reproduce the hydrated shell's observable behavior.

The run's server build now inlines dynamic imports (codeSplitting: false), because the shell's lazy route would otherwise split the never-measured server bundle. Server builds without dynamic imports are unchanged.

row raw gzip brotli
split-shell 417,861 133,510 114,986
split-shell-runtime 331,940 105,346 89,805
split-shell-signals 76,233 23,530 21,172

These rows are measured after merging main at c8256d8. #2033 cut the runtime chunk by about 5 KB. The findings below were measured at d37bd28.

Findings this scenario reproduces

These come from scratch tooling that is not in this diff: a Chromium precise-coverage probe and source-map attribution by module, top-level declaration and class member.

1. The #1855 / #1942 eliminations survive split chunks. 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 retain the same declarations. The extra 1.3 KB is cross-chunk import/export glue, plus oxc no longer inlining small functions across a chunk boundary (__derivedAt 746 B vs 220 B, visible 1,204 B vs 784 B).

A few other things I checked:

  • Published package vs source: building against the published dist/ (buildPublishedRuntime) lands within 10 B of source on both chunks.
  • advancedChunks: the deprecated advancedChunks form produces the same chunks as codeSplitting.groups.
  • Profiling define: __OCTANE_PROFILE_ENABLED__ comes from the plugin, so a build without a manual define is byte-identical.

Two caveats:

  • A codeSplitting: false build of a shell that has dynamic imports is not a valid baseline. Rolldown wraps every module in __esmMin lazy initializers there, and those add about 18 KB.
  • 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. The signals group also swallows the whole runtime once an entry imports octane/signals/client. Chunk totals therefore depend on the chunking config, so compare per module, not per chunk.

2. About a third of the runtime chunk executes, and most of what doesn't run is still needed. Chromium precise coverage gives these execution rates:

Chunk Through hydrate + one task After menu, portal and route-transition interactions
runtime 23.1% 36.9%
signals 27.0% 31.6%

The audited app measured 36%. The table below groups the runtime chunk by owning capability. The grouping uses name heuristics, so the shares are approximate:

Capability KB run at hydrate run after interactions largest never-run declarations (bytes)
hydration capability + adoption 56.1 33% 34% hydrateRootWithOutputHandler 2,295, coalesceHydratedRanges 1,078, HydrationCapability.adopt 974
render core / roots / scheduler 46.8 29% 46% componentSlotImpl 3,461, renderBranchSlot 2,993, makeRoot 2,326
Suspense / @Try / offscreen 35.1 15% 30% switchToCatchInner 1,803, attemptHiddenRevealInner 1,783, mountTry 1,596
generic children / descriptors / de-opt 30.9 1% 15% childSlot 7,551, renderPreparedChildList 3,236, deoptItemBody 1,966
transitions + render journal 23.7 6% 50% holdRootTransition 793, nativeCandidateForAction 717, rollbackRootRender 584
keyed lists 18.6 10% 13% reconcileKeyed 3,970, forBlock 1,400, restoreForSlot 1,253
deferred Hydrate / islands activation 18.1 35% 38% activateHydrateBoundary 1,551, handleEarlyHydrationIntent 1,497
DOM props / forms / controlled 17.3 36% 48% maybeEnqueueRestore 1,317, setAttribute 1,260
hooks / effects / refs 16.2 26% 36% detachRegisteredSubtreeRefs 1,032, reconnectBailedEffects 805
native signal reads 14.0 31% 39% bindSignalChild 942, bindDirectSignal 800
behavior root 12.8 32% 48% registerExternalRange 1,246, registerBehavior 799
events 11.7 32% 61% dispatchDelegatedCapture 553, finishCaptureDispatch 422
portals 4.4 1% 47% resolvePortalEventOwner 585
other 30.2 26% 40%

Code that never runs here is not the same as code that can be removed. Nearly all of it belongs to capabilities this shape uses: mismatch recovery, catch arms, keyed reorders and transition rollback. {createPortal()} in a hole is what retains the generic children / de-opt path, through textHoleUpdate → childSlot.

The genuinely dead bytes I found:

What Size Why it is dead Status
Class members whose class is kept but that nothing calls ~1.3 KB here (HydrationCapability.seedOrCreate 457 B and .adoptBindingText 319 B, whose only callers are tree-shakable exports); in simpler hydrating fixtures, 13.1 KB of hydrate-root's 118.5 KB and 7.2 KB of deferred-hydration The class is retained, so all its members are Mostly not movable: most callers are client-reachable behind hydrating guards that esbuild never folds, so moving the bodies out would grow esbuild/Rspack createRoot-only bundles. Only three methods whose sole caller is activateHydrateBoundary are safe (~0.4 KB).
Server-only seed serialization in every client signals chunk (ScopeImpl.serializeRead → serializeScopeRead + scopeSeedEntry + encodeSignalValue) ≈2.1 KB raw Only the server read driver calls it Separate PR
English error strings that behavior-root.ts throws in production ~650 B Outside the error catalog's declared scope

3. The signals engine did not grow between 0.10.2 and 0.13.1. I built the same shell against both npm tarballs, 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. #1986's vendoring is a move:

  • graph.js grew by 1,270 B.
  • alien-signals/esm/system.mjs (1,866 B) dropped out.
  • Net effect: −0.6 KB.

Other changes over the same range:

  • engine.js: −3,363 B.
  • runtime.js: −9,758 B.

A chunk-total growth between those releases comes from chunk assignment or from app changes, not from the engine.

Validation

  • node benchmarks/bundle-size/run-minimal.mjs split-shell hydrate-frame hooks-state server-render binding-aria-esbuild deferred-hydration: all pass. The other rows are unchanged by the refactored row and server-markup paths.
  • Negative check: adding renderHiddenActivity to the kept controls fails the run with the driver assertion.
  • pnpm format:files:check on the changed files
  • pnpm sync: no generated changes
  • pnpm typecheck: not applicable. No TypeScript project includes benchmarks/bundle-size/fixtures/**, as with the existing minimal fixtures.
  • pnpm test: not run locally. This is bench harness only, and PR CI runs bundle-reachability.
  • perf-review: not applicable (benchmark harness only).
  • concise-code:
    • Size: run-minimal +150 net (the row loop re-indents the existing push), verify-reachability +9, README +13, and a 7-file fixture.
    • Alternatives considered:
    • Bytes: new rows only.

Risk / follow-ups

  • The new rows have no base on this PR, so the report shows them as added.
  • Two follow-ups are tracked separately:
    • HydrationCapability dead members. A follow-up session checked them: most callers are client-reachable, and hydrating doesn't fold under esbuild, so a broad move would grow esbuild/Rspack createRoot-only bundles. The 13.1 KB on hydrate-root is an artifact of its one-component fixture, and the realistic hydrate-frame has about 0.9 KB. Only the three methods activateHydrateBoundary alone calls are being moved (~0.4 KB).
    • Keep server seed serialization out of client signal bundles (−2.1 KB on split-shell-signals): perf(octane): keep server seed serialization out of client signal bundles #2035.

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.


Note

Low Risk
Benchmark and documentation changes only; no production runtime or bundler behavior is modified.

Overview
Adds a split-shell scenario to bundle-reachability so CI measures a production-style Rolldown + oxc app: ESM code-splitting groups for octane-signals-engine and octane-runtime, dynamic-import hydration, and a behavior island before the renderer loads.

The harness gains a vite-split build path that asserts app chunks contain no Octane sources, uses source maps to ensure the runtime chunk drops unused ViewTransition/Activity drivers, links chunks into one jsdom script for the behavior oracle, and reports three byte rows (full app, runtime chunk, signals chunk) with per-file compression. SSR markup for scenarios now accepts an explicit server entry and disables server code splitting so lazy routes stay in one server bundle.

Fixture count in the README moves from 25/33 to 29/38 builds; verify-reachability adds the expected snapshot for the new scenario.

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

…chability

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]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 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 3ce42c4 Oct 13 2026, 11:12 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 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 3ce42c4 Oct 13 2026, 11:12 AM

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent test PR: tests only labels Oct 13, 2026
@trueadm
trueadm marked this pull request as ready for review October 13, 2026 10:12

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Chunk linking breaks on Windows paths
    • Added .replaceAll('\\', '/') to the path.relative result in linkChunks's resolveId so the entry branch produces POSIX keys matching the chunk fileName map; the splitGroups regexes and id.includes guards are not bugs because Rollup/Rolldown module IDs are always forward-slash.

Create PR

Or push these changes by commenting:

@cursor push 10e56ad3f6
Preview (10e56ad3f6)
diff --git a/benchmarks/bundle-size/run-minimal.mjs b/benchmarks/bundle-size/run-minimal.mjs
--- a/benchmarks/bundle-size/run-minimal.mjs
+++ b/benchmarks/bundle-size/run-minimal.mjs
@@ -404,7 +404,7 @@
 				resolveId(source, importer) {
 					const file = importer?.startsWith(prefix)
 						? path.posix.join(path.posix.dirname(importer.slice(prefix.length)), source)
-						: path.relative(directory, source);
+						: path.relative(directory, source).replaceAll('\\', '/');
 					return files.has(file) ? prefix + file : null;
 				},
 				load(id) {

You can send follow-ups to the cloud agent here.

Comment thread benchmarks/bundle-size/run-minimal.mjs Resolved
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

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

Compares 5594cb06e, the merge commit's first parent (main has moved 1 commit(s) past the pull request's recorded base c8256d8a8) with 4cb032884 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 2.683 2.658 ±0.0% −3.6% … +0.0% ⚪ within noise
octane-tsrx replace 5.658 5.683 −2.4% −4.6% … +2.8% ⚪ within noise
octane-tsrx add 2.550 2.633 ±0.0% ±0.0% … +4.4% ⚪ within noise
octane-tsrx update 0.127 0.131 −0.6% −3.1% … +4.7% ⚪ within noise
octane-tsrx select 0.006 0.006 −1.1% −3.2% … +3.4% ⚪ within noise
octane-tsrx swap 0.019 0.019 −1.7% −5.6% … +3.2% ⚪ within noise
octane-tsrx remove 0.018 0.017 −3.3% −14.4% … +6.3% ⚪ within noise
octane-tsrx runlots 25.192 25.575 +0.6% −2.5% … +3.7% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 +1.6% −1.1% … +3.8% ⚪ within noise
octane-tsrx clear 46.500 44.908 −4.0% −6.6% … −1.4% ⚪ within noise
octane-jsx run 3.600 3.658 ±0.0% −0.0% … ±0.0% ⚪ within noise
octane-jsx replace 8.000 8.092 +2.9% −7.2% … +9.3% ⚪ within noise
octane-jsx add 3.200 3.192 ±0.0% −1.2% … +4.5% ⚪ within noise
octane-jsx update 0.264 0.263 +2.3% −1.8% … +4.5% ⚪ within noise
octane-jsx select 0.130 0.130 +0.3% −1.1% … +1.7% ⚪ within noise
octane-jsx swap 0.198 0.197 +0.5% −2.1% … +3.0% ⚪ within noise
octane-jsx remove 0.183 0.171 ±0.0% −3.0% … +1.6% ⚪ within noise
octane-jsx runlots 28.025 27.117 +2.1% −3.9% … +4.6% ⚪ within noise
octane-jsx select_lots 1.540 1.470 −4.1% −6.1% … −1.4% ⚪ within noise
octane-jsx clear 45.167 47.100 +1.0% −2.3% … +3.8% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 93 measured values.

Public-import reachability bundles (bytes)

target metric base head Δ
split-shell raw – 417,861 – 🆕
split-shell gzip – 133,510 – 🆕
split-shell brotli – 114,986 – 🆕
split-shell-runtime raw – 331,940 – 🆕
split-shell-runtime gzip – 105,346 – 🆕
split-shell-runtime brotli – 89,805 – 🆕
split-shell-signals raw – 76,233 – 🆕
split-shell-signals gzip – 23,530 – 🆕
split-shell-signals brotli – 21,172 – 🆕

111 other measured values are unchanged.

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]>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Chunk rows share full module graph
    • Added per-chunk modules to the runtime and signals rows in buildSplitScenario, and updated the consumer to prefer row.modules over the global modules list, so each row's metadata now reflects only the modules present in its own chunk.

Create PR

Or push these changes by commenting:

@cursor push b00963d68e
Preview (b00963d68e)
diff --git a/benchmarks/bundle-size/run-minimal.mjs b/benchmarks/bundle-size/run-minimal.mjs
--- a/benchmarks/bundle-size/run-minimal.mjs
+++ b/benchmarks/bundle-size/run-minimal.mjs
@@ -486,8 +486,16 @@
 		executable: await linkChunks(chunks, entryChunk),
 		rows: [
 			{ name: scenario.name, files },
-			{ name: `${scenario.name}-runtime`, files: [runtime.code] },
-			{ name: `${scenario.name}-signals`, files: [signals.code] },
+			{
+				name: `${scenario.name}-runtime`,
+				files: [runtime.code],
+				modules: Object.keys(runtime.modules),
+			},
+			{
+				name: `${scenario.name}-signals`,
+				files: [signals.code],
+				modules: Object.keys(signals.modules),
+			},
 		],
 		modules,
 		runtimeExports: runtime.modules[runtimeModule].renderedExports,
@@ -842,7 +850,7 @@
 					Object.entries(measured).map(([metric, value]) => [metric, stat(value)]),
 				),
 				meta: {
-					modules: modules.map((id) =>
+					modules: (row.modules ?? modules).map((id) =>
 						id.startsWith(repository + path.sep) ? path.relative(repository, id) : id,
 					),
 					hasRuntime,

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit e9d2902. Configure here.

Comment thread benchmarks/bundle-size/run-minimal.mjs Resolved
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]>
@trueadm
trueadm merged commit 2dfe1c0 into main Oct 13, 2026
31 of 33 checks passed
@trueadm
trueadm deleted the test/split-shell-reachability branch October 13, 2026 12:03
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.

1 participant