Skip to content
AI Primer
release

Next.js 16.5 cuts cold Turbopack compile time 76%

Next.js 16.5 reports 76% faster cold Turbopack compiles and 38% lower memory use. It also adds cross-deployment caching, scheduled agent upgrades, experimental Go routes and sandboxed image optimization.

6 min read
Next.js 16.5 cuts cold Turbopack compile time 76%
Next.js 16.5 cuts cold Turbopack compile time 76%

TL;DR

  • Cold Turbopack compilation fell from 183 seconds to 44 seconds on Vercel’s dashboard, with 38% lower peak memory, according to Next.js’s measurements.
  • Remote cache entries can survive deployments when function code, dependencies, and relevant environment values stay unchanged, as Next.js explains.
  • Scheduled coding agents can now open upgrade PRs through GitHub Actions using the new CI upgrade command.
  • Go Route Handlers and sandboxed image optimization ship as experimental features in Next.js 16.5.

An independent two-core benchmark found much smaller speedups than Vercel’s dashboard. The cache-key rules have an escape hatch for dynamic environment reads. And the native-language announcement goes beyond Go endpoints into a replacement production server.

Turbopack compilation

Next.js compared 16.5 against 16.4.6 using Vercel’s dashboard on a 30-core, 60 GB build machine. Its release benchmark reports:

  • Cold compilation: 183 seconds → 44 seconds, about 76% less elapsed time.
  • Warm compilation: 12 seconds → 4.4 seconds, about 63% less elapsed time.
  • Cold peak memory: 38% lower.
  • Full cold production build: roughly half the elapsed time.

The team attributes the improvements to better CPU-core utilization, scaling to thousands of routes, and lower memory and disk overhead. Across five other Vercel apps, peak-memory reductions ranged from 6% to 27%.

Smaller CI runners produced a different result. Building a 92-page static export on a two-vCPU, 7 GB GitHub Actions runner, Meet Modi measured:

  • Cold compilation: 7.0 seconds → 5.2 seconds, a 1.35× speedup.
  • Full cold build: 16.1 seconds → 13.8 seconds, about 14% less time.
  • Peak memory: 21% lower.
  • Warm builds: essentially unchanged.

Modi ran each version three times cold and three times warm under Node 22. Warm compilation was already under half a second; rendering the site’s pages accounted for much of the remaining build time.

Turbopack disk cache

The turbopackGc garbage collector, experimental in 16.4, is enabled by default in 16.5. It removes unused compilation work so the cache grows with application size rather than the number of edits.

Next.js reports a 14% smaller disk cache for Vercel’s dashboard and reductions of up to 23% on other Vercel apps.

Cross-deployment cache keys

Previously, every build or deployment ID changed the key for functions marked 'use cache: remote', even after an unrelated edit. Turbopack now determines reuse from:

  1. The cached function’s code.
  2. Its dependencies, including transitive imports.
  3. The environment values it reads.

Entries still expire and revalidate normally. Changes to a dependency or relevant environment value invalidate reuse.

Dynamic reads such as process.env[variable] or parseConfig(process.env) trigger the deployment-specific fallback, because Turbopack cannot determine the complete dependency set.

Cross-deployment caching is this release’s sleeper feature.

Production bundle reports

next build --analyze generates a bundle report during the production compilation, eliminating the separate compilation previously needed for analysis.

The build-integrated report lands in .next/diagnostics/analyze. Its JavaScript, CSS, and source maps match the production deployment’s output.

Alternating between analyzed and plain builds had a catch in Modi’s test: each switch caused a near-cold compilation. Consecutive builds in the same mode stayed warm.

Next.js 16.5 adds a link-level override for the navigation() API introduced in 16.4:

  • await navigation(): defers content until navigation rather than including it in ordinary prefetches.
  • <Link prefetch="navigation">: bypasses that gate for an individual link, prefetching all cached content for its destination.

The override covers cached content, including content behind await navigation().

Scheduled agent upgrades

npx next@canary upgrade --ci configures scheduled GitHub Actions upgrades. The setup flow has four parts:

  1. Upgrade policy: security advisories only, or every new stable release.
  2. Agent and credentials: Codex or Claude Code, with an OpenAI or Anthropic API key, a Vercel AI Gateway key, or a Claude subscription.
  3. Setup PR: the command opens a pull request adding the workflow and helps store credentials as repository secrets.
  4. Daily execution: after merging, the workflow checks releases daily; matching releases trigger an agent upgrade and a pull request with the result.

For local upgrades, Next.js’s instructions still list npx next@canary upgrade --agent=latest; the manual installation command is npm install next@latest.

Go Route Handlers

Experimental route.go files expose native endpoints alongside TypeScript routes in the App Router. The API reference specifies:

  • Requirements: Go 1.24 or newer, Turbopack, and experimental.goRoutes: true. Webpack is unsupported.
  • HTTP interface: standard Go net/http handlers named for HTTP methods. Dynamic parameters use r.PathValue(); streaming uses http.Flusher.
  • Development: edits recompile the affected route rather than every Go route.
  • Production: all Go routes compile into one executable and share one process. Package initialization failures affect every Go route.
  • Rendering limits: Go routes always execute dynamically. ISR, generateStaticParams, and output: 'export' are unsupported.

The native-language announcement says builds target the build host’s OS and architecture with CGO disabled. Production runs the compiled executable without requiring the Go toolchain.

Adding one hello-world endpoint took cold compilation from about 5 seconds to 34.7 seconds in Modi’s test. He did not test a warmed Go cache.

Sandboxed image optimization

experimental.imgOptSafeMode: true opts next/image into an alternative optimizer using:

  • Memory-safe image decoders.
  • Process isolation.
  • Linux seccomp sandboxing.

Vercel already uses the same sandbox protection for its platform image transformations, according to cramforce. The release notes say the flag may be ignored in production when a hosting platform supplies its own image optimizer.

Making safe mode the default would be a breaking change and cannot happen before Next.js 17, cramforce explained in a follow-up.

Go-based production server

The experimental Go rewrite of next start owns the public port and dispatches matching Go requests directly, avoiding a Node.js hop. React rendering and JavaScript/TypeScript routes continue running on Node.js.

The production-server flag is next start --experimental-new-server.

In an early first-party benchmark of a Go endpoint, direct dispatch through the Go-based server produced:

  • Throughput: 5,956 → 25,818 requests per second, about 4.3× higher.
  • p99 latency: 59% lower.
  • CPU per request: 37% lower.

Requests still served by Node.js, including route.ts handlers, dynamic pages, and public/ assets, currently pass through an extra proxy hop. The native-runtime contract for hosting adapters remains undecided; Next.js says it will finalize that API before Go Route Handlers become stable.

Further reading

Discussion across the web

Where this story is being discussed, in original context.

On X· 3 threads
TL;DR1 post
Scheduled agent upgrades1 post
Sandboxed image optimization2 posts
Share on X