Skip to content

feat(bench): show bundle-size as a range up to the whole client runtime - #1738

Merged
trueadm merged 2 commits into
mainfrom
feat/bundle-size-ceiling
Oct 5, 2026
Merged

trueadm merged 2 commits into
mainfrom
feat/bundle-size-ceiling

Conversation

@o-alexandrov

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

Copy link
Copy Markdown
Contributor

Summary

  • bundle-size now also measures each framework's whole client runtime (every export of every framework entry point its fixtures import), and the website draws each bar as a range: solid for what the fixture ships, hatched up to the same application once it uses the whole client API.
  • Frameworks whose runtime cannot tree-shake (React, Inferno) stay single bars: a ceiling is attached only when the whole runtime is at least 1.1× what the fixture ships, so separate-build noise never draws a range. Frameworks that tree-shake show how far their number depends on fixture size.

Why

  • Every fixture (rows, TodoMVC, chat, weather) uses a small slice of the API, and none hydrates. Octane tree-shakes well, so its fixtures ship 39–49 kB gzip of runtime, while React ships its whole ~60 kB regardless. The home summary therefore reads "React 1.3× Octane", but an application using hydration, Suspense, transitions and signals ships Octane's whole runtime: 174 kB gzip, against React's 60 kB.
  • Readers cannot tell from a single number which case applies to them. A range shows both ends from the same run.
framework overall today overall, whole client API
Preact 0.18× 0.27×
Inferno 0.23× (single bar)
Solid 0.34× 0.89×
Ripple 0.35× 0.67×
Svelte 0.42× 0.77×
Vue Vapor 0.54× 1.8×
Octane (.tsrx) 1× 3.7×
React + Compiler 1.3× (single bar)

Changes

  • benchmarks/bundle-size/run.mjs: while building each fixture, record the bare framework specifiers application modules import (resolved ids, so export conditions match the fixture build). After all sets, build one ceiling entry per framework that retains import * as of each, with the same normalized minify and framework chunk split, and report full_fw_raw/gzip/brotli. The Octane-only bindings set is excluded because its imports are bindings, not framework entry points. No budget or ratio guard is added; run-minimal.mjs keeps gating individual public imports.
  • website/src/content/benchmarks.ts: BenchCard.ceilings (row → series → upper end). The bundle-size card sets it to each row's app_gzip plus full_fw_gzip.
  • BenchBars.tsrx / BenchmarkExplorer.tsrx: draw the extension hatched in the series color and label it low–high; a range whose ends format identically stays a single bar. The overall view uses the geomean of ceilings over Octane's row values, so both ends share the 1× line. The data table gains "…, whole client API" rows.
  • home-benchmark.ts: createHomeSummary emits the same ceilings for cards that have them; HOME_SUMMARY regenerated (smoke test checks it against createHomeSummary).
  • benchmarks/baselines/local/bundle-size.json: re-recorded with node benchmarks/bench.mjs --record bundle-size. Besides the new full_fw_* ops, the existing Octane rows move by a few hundred bytes because main's runtime grew since the 0.8.0 recording; other frameworks' bytes are unchanged.

Validation

  • pnpm format:check (ran pnpm format:files:check over benchmarks/bundle-size, the baseline, website/src, website/tests: clean)
  • pnpm typecheck (ran pnpm typecheck:files on the 5 website files: clean; run.mjs is in no TS project, node --check passes)
  • pnpm test
  • targeted tests: vitest run website/tests, 31 files / 529 tests pass. The bench-bars range test walks every bundle-size row; it fails on 3f20bcc (weather total gzip/react: expected NaN to be greater than 0, the inverted range Bugbot reported) and with ranges disabled, and passes now.
  • node benchmarks/bundle-size/run.mjs --budgets octane-tsrx octane-jsx: 6 application budgets hold.
  • Checked both charts visually in the dev server (home explorer and /benchmarks card).

Risk / follow-ups

  • The ceiling is an upper bound for the specifiers a fixture already imports; it does not add server, hydration-only or subpath entries the fixtures never touch (e.g. React's react-dom/server, Octane's octane/hydration), so it is conservative for every framework.
  • A possible follow-up is a realistic SSR row: building weather's existing entry-delivery-client hydration entries would give a measured mid-point between the two ends.

Provenance

  • An agent produced this diff (agent-authored)

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 reporting and marketing-site visualization only; no runtime or auth changes. Baseline JSON drift is expected when re-recording.

Overview
Bundle-size benchmarks and charts now show fixture bytes as a range up to “whole client API” size, so readers can see when small fixtures tree-shake the runtime vs shipping it all (e.g. React stays a single bar; Octane shows a large hatched extension).

The harness (run.mjs) records bare framework specifiers during fixture builds, then runs a per-framework ceiling build that retains import * of those entry points and emits full_fw_* metrics plus meta.ceiling specifiers; the bindings fixture skips ceiling. bundle-size.json is re-recorded with the new ops and refreshed Octane byte counts.

On the site, BenchCard.ceilings is derived for the bundle-size card (app_gzip + full_fw_gzip, only when runtime is ≥1.1× fixture framework bytes). BenchBars and BenchmarkExplorer draw a hatched segment, low–high labels, tooltips, and table rows for “whole client API”; the home summary propagates ceiling geomeans for bundle-size. Tests cover which frameworks get ranges.

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

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability labels Oct 5, 2026

@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: Ceiling can invert bundle-size ranges
    • A bundle-size bar now extends only when the whole-API ceiling clears the shipped size by at least 1 kB, so gzip noise no longer draws an inverted or one-kilobyte range, and the track scales to the solid bar.

Create PR

Or push these changes by commenting:

@cursor push c8619174a1
Preview (c8619174a1)
diff --git a/website/src/components/BenchBars.tsrx b/website/src/components/BenchBars.tsrx
--- a/website/src/components/BenchBars.tsrx
+++ b/website/src/components/BenchBars.tsrx
@@ -76,14 +76,20 @@
 	ink: FillInk;
 }
 
-// A ceiling that prints the same as its value would read "10 kB–10 kB", so the
-// bar stays a single value.
+// A ceiling draws a range only when it is a higher displayed value. The
+// whole-runtime build is separate from the fixture, so gzip can disagree by a
+// few hundred bytes in either direction and still round across a kilobyte.
+// That noise is not unused client API: a byte ceiling has to clear the bar by
+// at least 1 kB, and a ceiling below the bar must not invert the label.
 function rangeEnd(
 	value: number,
 	ceiling: number | undefined,
 	format: (value: unknown) => string,
 ): number | undefined {
-	return ceiling !== undefined && format(ceiling) !== format(value) ? ceiling : undefined;
+	if (ceiling === undefined || !(ceiling > value)) return undefined;
+	if (format(ceiling) === format(value)) return undefined;
+	if (format === fmtBytes && ceiling - value < 1024) return undefined;
+	return ceiling;
 }
 
 function geomeanRatio(pairs: Array<[number, number]>): number {
@@ -101,7 +107,9 @@
 function barView(present: BarItem[], missing: BarView['missing']): BarView {
 	present.sort((a, b) => a.value - b.value);
 	let max = 0;
-	for (const item of present) max = Math.max(max, item.ceiling ?? item.value);
+	// The track has to cover the solid bar. A ceiling below its value is noise,
+	// not a shorter scale.
+	for (const item of present) max = Math.max(max, item.value, item.ceiling ?? 0);
 	// 1.05 headroom keeps the longest bar off the card edge; an all-zero row
 	// (sub-timer-resolution scores) falls back to 1 so fractions stay finite.
 	return { present, missing, scaleMax: max > 0 ? max * 1.05 : 1 };

diff --git a/website/tests/bench-bars.test.ts b/website/tests/bench-bars.test.ts
--- a/website/tests/bench-bars.test.ts
+++ b/website/tests/bench-bars.test.ts
@@ -157,44 +157,61 @@
 
 	it('extends a bundle-size bar to its whole-API ceiling only where tree-shaking leaves a gap', async () => {
 		const bundleSize = FRAMEWORK_CARDS.find((c) => c.id === 'bundle-size')!;
-		const row = bundleSize.rows[0];
-		const ceilings = bundleSize.ceilings![row.op as string];
 		const { container, opButton } = await mountCard(bundleSize);
 
-		fireEvent.click(opButton(row.op as string));
-
-		await waitFor(() =>
-			expect(opButton(row.op as string).getAttribute('aria-pressed')).toBe('true'),
-		);
-		const ranged: string[] = [];
-		const single: string[] = [];
-		for (const series of numericSeries(bundleSize, 0)) {
-			const value = row[series.key] as number;
-			const ceiling = ceilings[series.key];
-			// Ranges whose ends round to the same kB stay single bars.
-			(Math.round(ceiling / 1024) > Math.round(value / 1024) ? ranged : single).push(series.key);
-		}
 		// The fixtures leave both kinds of framework on the card.
-		expect(ranged.length).toBeGreaterThan(0);
-		expect(single.length).toBeGreaterThan(0);
+		let sawRange = false;
+		let sawSingle = false;
+		for (const [index, row] of bundleSize.rows.entries()) {
+			const ceilings = bundleSize.ceilings![row.op as string];
+			fireEvent.click(opButton(row.op as string));
+			await waitFor(() =>
+				expect(opButton(row.op as string).getAttribute('aria-pressed')).toBe('true'),
+			);
+			const ranged: string[] = [];
+			const single: string[] = [];
+			for (const series of numericSeries(bundleSize, index)) {
+				const value = row[series.key] as number;
+				const ceiling = ceilings[series.key];
+				// A separately built whole runtime can sit a few hundred gzip bytes
+				// either side of the fixture and still round to another kilobyte.
+				// Only a gap of at least 1 kB is unused client API.
+				(ceiling - value >= 1024 && Math.round(ceiling / 1024) > Math.round(value / 1024)
+					? ranged
+					: single
+				).push(series.key);
+			}
+			if (ranged.length > 0) sawRange = true;
+			if (single.length > 0) sawSingle = true;
 
-		const rows = Array.from(container.querySelectorAll('.bench-row:not(.bench-row-empty)'));
-		const labelOf = (key: string) => rows.find((r) => r.getAttribute('data-series') === key)!;
-		for (const key of ranged) {
-			const bar = labelOf(key);
-			expect(bar.querySelector('.bench-fill-range'), key).not.toBeNull();
-			expect(bar.querySelector('.bench-val')!.textContent, key).toMatch(/kB–\d+ kB$/);
+			const rows = Array.from(container.querySelectorAll('.bench-row:not(.bench-row-empty)'));
+			const labelOf = (key: string) => rows.find((r) => r.getAttribute('data-series') === key)!;
+			for (const key of ranged) {
+				const bar = labelOf(key);
+				const hatch = bar.querySelector<HTMLElement>('.bench-fill-range');
+				const fill = bar.querySelector<HTMLElement>('.bench-fill')!;
+				expect(hatch, `${row.op}/${key}`).not.toBeNull();
+				expect(parseFloat(hatch!.style.width), `${row.op}/${key}`).toBeGreaterThan(0);
+				expect(parseFloat(fill.style.width), `${row.op}/${key}`).toBeLessThanOrEqual(100);
+				expect(bar.querySelector('.bench-val')!.textContent, `${row.op}/${key}`).toMatch(
+					/kB–\d+ kB$/,
+				);
+			}
+			for (const key of single) {
+				const bar = labelOf(key);
+				const fill = bar.querySelector<HTMLElement>('.bench-fill')!;
+				expect(bar.querySelector('.bench-fill-range'), `${row.op}/${key}`).toBeNull();
+				expect(bar.querySelector('.bench-val')!.textContent, `${row.op}/${key}`).not.toContain('–');
+				expect(parseFloat(fill.style.width), `${row.op}/${key}`).toBeLessThanOrEqual(100);
+			}
 		}
-		for (const key of single) {
-			const bar = labelOf(key);
-			expect(bar.querySelector('.bench-fill-range'), key).toBeNull();
-			expect(bar.querySelector('.bench-val')!.textContent, key).not.toContain('–');
-		}
+		expect(sawRange).toBe(true);
+		expect(sawSingle).toBe(true);
 		// The exact ceilings stay readable without the hatching.
 		const tableRows = Array.from(container.querySelectorAll('tbody th'), (th) =>
 			th.textContent!.trim(),
 		);
-		expect(tableRows).toContain(row.op + ', whole client API');
+		expect(tableRows).toContain(bundleSize.rows[0].op + ', whole client API');
 	});
 
 	it('charts a single-series card as one bar per operation, with no picker', async () => {

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

Reviewed by Cursor Bugbot for commit 3f20bcc. Configure here.

Comment thread website/src/content/benchmarks.ts Resolved
@vercel

vercel Bot commented Oct 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
octane-website-mcp Skipped Skipped Oct 5, 2026 3:59am UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp October 5, 2026 03:59 Inactive
@o-alexandrov
o-alexandrov marked this pull request as ready for review October 5, 2026 04:04
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No budget breaches, no added work, and no timing changes beyond ±3%.

Compares 7a92ad2a1, the merge commit's first parent with 28b1eca19 on the same runner. A byte value over its committed budget or any increase in a js-framework work counter fails this check. 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.908 2.892 ±0.0% −3.3% … +3.1% ⚪ within noise
octane-tsrx replace 5.875 6.025 −1.8% −6.2% … +0.0% ⚪ within noise
octane-tsrx add 2.425 2.458 +4.1% ±0.0% … +4.2% ⚪ within noise
octane-tsrx update 0.116 0.114 −0.3% −2.4% … +1.2% ⚪ within noise
octane-tsrx select 0.005 0.005 −1.0% −1.8% … −0.5% ⚪ within noise
octane-tsrx swap 0.033 0.034 +3.7% +1.9% … +4.7% ⚪ within noise
octane-tsrx remove 0.016 0.016 −0.8% −1.2% … +0.8% ⚪ within noise
octane-tsrx runlots 22.333 23.858 +5.0% +0.9% … +6.6% ⚪ within noise
octane-tsrx select_lots 0.005 0.006 −0.6% −1.8% … +0.3% ⚪ within noise
octane-tsrx clear 41.475 39.825 −1.2% −2.6% … −0.4% ⚪ within noise
octane-jsx run 3.333 3.283 −1.4% −4.2% … ±0.0% ⚪ within noise
octane-jsx replace 6.517 6.383 −2.3% −4.6% … +0.7% ⚪ within noise
octane-jsx add 3.183 3.158 −3.0% −5.6% … +0.0% ⚪ within noise
octane-jsx update 0.248 0.249 −0.3% −1.7% … +1.3% ⚪ within noise
octane-jsx select 0.121 0.120 +0.8% ±0.0% … +1.6% ⚪ within noise
octane-jsx swap 0.216 0.224 ±0.0% −0.6% … +1.1% ⚪ within noise
octane-jsx remove 0.166 0.164 −0.6% −1.4% … +0.3% ⚪ within noise
octane-jsx runlots 27.308 27.300 +0.9% −2.8% … +2.5% ⚪ within noise
octane-jsx select_lots 1.373 1.349 −0.9% −1.9% … +1.0% ⚪ within noise
octane-jsx clear 43.033 43.250 +0.6% −0.2% … +1.8% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx bindings_js_gzip 240,865 240,853 −12 (−0.0%) 🟢
octane-tsrx bindings_js_brotli 205,129 204,952 −177 (−0.1%) 🟢
octane-tsrx bindings_app_gzip 121,729 121,717 −12 (−0.0%) 🟢
octane-tsrx bindings_app_brotli 101,815 101,638 −177 (−0.2%) 🟢
octane-tsrx full_fw_raw – 569,319 – 🆕
octane-tsrx full_fw_gzip – 174,423 – 🆕
octane-tsrx full_fw_brotli – 147,294 – 🆕
octane-jsx full_fw_raw – 569,319 – 🆕
octane-jsx full_fw_gzip – 174,423 – 🆕
octane-jsx full_fw_brotli – 147,294 – 🆕

50 other measured values are unchanged.

Public-import reachability bundles (bytes)

No changes across 105 measured values.

@trueadm
trueadm merged commit d7ee29b into main Oct 5, 2026
54 checks passed
@trueadm
trueadm deleted the feat/bundle-size-ceiling branch October 5, 2026 07:08
trueadm added a commit that referenced this pull request Oct 6, 2026
Conflicts:
- pnpm-lock.yaml: keep this branch's TSRX versions under main's
  @types/node 24.13.3 peer context. `pnpm install --lockfile-only`
  (pnpm 12.9.1) leaves the result unchanged.
- 87 react-parity manifests: lockfileSha256 regenerated for the merged
  lockfile (react-parity:lockfiles:generate).
- website BenchBars.tsrx and BenchmarkExplorer.tsrx: this branch only
  reformatted them, so take main's #1738 version and reformat it.
- user-apps-v1 manifest.jsonl: regenerated by pnpm sync.
- minimal-budgets.json: main re-baselined suspense-transition and
  binding-apollo-client-vite under the Oxc minifier (#1792), so this
  branch's earlier raises for the reformat are dropped.

Reformat the 16 .tsrx files main added or changed in the old layout.
Their client and server output is unchanged once position-derived ids
are masked, and all 51 .tsrx files main touched compile in both modes.

The reformat moves position-derived ids, which makes some bundles a few
bytes smaller than main's budgets allow under the ratchet, so tighten
them: context gzip -2, suspense-transition gzip -1, apollo esbuild
brotli -99, bindings total raw -12. The bindings app and total gzip are
set 27 bytes over the local measurement rather than 32, because CI has
measured that app's gzip 5 bytes below local.

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

This branch was previously deployed

1 inactive deployment
Preview – octane-website-mcp — 6aea57d5 Deployed Oct 5, 2026 by vercel[bot]
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 feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants