Skip to content

chore(benchmarks): record Next.js (Turbopack) at 5000 routes — vinext 5.3× faster#2391

Closed
hyf0 wants to merge 2 commits into
cloudflare:mainfrom
hyf0:bench/nextjs-large-turbopack
Closed

chore(benchmarks): record Next.js (Turbopack) at 5000 routes — vinext 5.3× faster#2391
hyf0 wants to merge 2 commits into
cloudflare:mainfrom
hyf0:bench/nextjs-large-turbopack

Conversation

@hyf0

@hyf0 hyf0 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Depends on #2388 — this extends the 5000-route scenario that PR adds, so merge it first (or merge this directly; its diff already includes that commit).

What

Adds Next.js (Turbopack) as a second implementation of the "Production build time (5000 routes)" scenario from #2388, via a new benchmarks/nextjs-large fixture — so the dashboard records how vinext and Turbopack compare at scale, not only at the default ~33 routes.

  • benchmarks/nextjs-large/ — a Turbopack fixture mirroring benchmarks/nextjs (same Next.js version/config), built at 5000 routes.
  • scenarios.json — adds the nextjs-large setup (npm install + 5000-route generate) and a Next.js implementation on production-build-large.
  • build-time.mjs — accepts nextjs-large (built with next build --turbopack, like nextjs).

Why

The headline dashboard compares the two at ~33 routes, where vinext builds ~31.5% faster than Turbopack. That lead is not constant — it widens with route count. Local, same machine, median of 3 clean production builds (total wall-clock):

Scale vinext Next.js (Turbopack) vinext faster
33 routes 2.6 s 5.1 s 1.95×
5,033 routes 20.2 s 106.0 s 5.26×

Marginal cost per added route ≈ 3.5 ms (vinext) vs 20 ms (Turbopack). The 33-route dashboard number understates vinext's advantage for realistic app sizes; recording the 5000-route comparison surfaces it.

Cost — the tradeoff to weigh

Main-runs only. Like the default Next.js benchmark, the Turbopack side is skipped on pull requests (it runs on main, or when its inputs change), so PR CI is unaffected. The cost is ~+100 s on each main perf run for the 5000-route Turbopack build. vinext's own 5000-route build (~20 s) already runs via #2388.

If the signal isn't worth the main minutes, feel free to close this — the vinext-only 5000-route scenario from #2388 stands on its own.

⚠️ CI wiring needed (for a maintainer)

Same as #2388: perf.yml doesn't know about the new fixture. To run green it needs the benchmarks/nextjs treatment applied to benchmarks/nextjs-large:

  • grant_write_paths — add benchmarks/nextjs-large to project_roots, and benchmarks/nextjs-large/{.next,node_modules} to paths.
  • "Validate performance workspace paths" — add benchmarks/nextjs-large (+ app/.next) to the checks.
  • PR skip — the "Detect Next.js benchmark input changes" step sets VINEXT_PERF_SKIP_IMPLEMENTATIONS=nextjs; it should also skip nextjs-large (and add it to the --implementation allowlist) so PRs don't measure it without setup. Inputs share the same Next.js version as nextjs, so the same fingerprint / fork-PR guard applies.

hyf0 added 2 commits June 28, 2026 13:52
Adds an app-scaling knob to generate-app.mjs (--extra/--target + VINEXT_BENCH_EXTRA_ROUTES) and a vinext-only 'Production build time (5000 routes)' perf scenario that builds a generated 5000-route app via a separate benchmarks/vinext-large fixture. Purpose: catch super-linear build-time regressions (e.g. route-graph directory scanning) that are invisible at the default ~33-route app. Separate fixture keeps the headline vinext-vs-Next comparison unchanged.
@hyf0 hyf0 marked this pull request as ready for review June 28, 2026 06:21
@pkg-pr-new

pkg-pr-new Bot commented Jun 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@2391
npm i https://pkg.pr.new/vinext@2391

commit: 2a835af

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant