Skip to main content

2026-11-30 · 5 min read

Measuring three experimental features: Rust React Compiler, inlined CSS, and the tsgo lint backend

Next.jsPerformance

Translated from the Chinese original: read it in Chinese

After upgrading all the packages to the latest, I went through the settings marked experimental in the Next.js 16.4 docs and picked three that relate to existing problems on this site. There is only one rule: measure first, ship only if the benefit is clear.

How I measured

For build time I used the project's own test-server script: every build goes into a brand-new folder (no cache), and I built once before and once after in the same time window. That desktop has other work running at the same time, so single numbers drift; I only compare "before and after in the same window".

For first-paint time I wrote a separate Playwright script that emulates a slow mobile network through the Chrome DevTools Protocol, with the same profile as Lighthouse's mobile test:

  • 150ms latency, 1.6 Mbps download, CPU 4x slower
  • A 390px-wide phone viewport
  • 5 runs per page, each in a fresh browser context (no cache), taking the median
  • A "return visit" mode: first open another page so CSS and JS are cached, then load the target page in full

1. Rust React Compiler (shipped)

reactCompiler: true,
experimental: { turbopackRustReactCompiler: true },

React Compiler used to be a Babel plugin, and Turbopack had to hand every file to a Node subprocess to run Babel. With this on, the Rust version runs directly inside Turbopack, and babel-plugin-react-compiler no longer needs to be installed.

Babel versionRust version
Compile (before and after in the same window)22.6 s19.9 s
JS before the home page loads203 KB203 KB
Memoized blocks after compiling775804

About 12% faster, which is not a lot. What matters more to me is another point: Turbopack runs Babel and PostCSS in the same pool of Node subprocesses. The day before, deploys had failed several times in a row, and the error was exactly that pool timing out while running PostCSS. With React Compiler out of Babel, only PostCSS is left in the pool.

There are 29 more memoized blocks, which means the Rust version memoizes a slightly different set than the Babel one. All E2E tests passed and the screens looked the same, but it is worth remembering: it is not "identical, just faster".

2. Inlined CSS (shipped)

experimental: { inlineCss: true },

Normally the browser downloads the HTML, reads the <link>, then downloads the CSS, and nothing is painted before the CSS arrives. With this on, the CSS goes straight into a <style> in the HTML.

For first-time visitors:

PageFCP before → afterLCP before → after
Home1628 → 904ms1944 → 1128ms
Post list1404 → 896ms1404 → 896ms
Exchange rate tool1164 → 668ms1164 → 668ms
Tech architecture page1396 → 1028ms1396 → 1028ms

This was bigger than I expected: 26 to 44% faster.

The cost is larger HTML. After gzip, the home page went from 87 to 144 KB, and the post list from 36 to 94 KB. That is more than I expected, and the reason is in the known limits in the Next docs: on the first load, the CSS appears once in the <style> and once more in the RSC payload. When navigating within the site to a prerendered page, it goes back to <link>, so it does not keep duplicating.

I was worried that returning visitors would lose out, since the CSS can no longer be cached on its own. Measuring the return-visit mode, inlining was still faster (home page FCP 788 → 136ms). Even with the CSS already in the cache, <link> still blocks first paint.

After shipping, this site collects Web Vitals from real visitors itself, and I will compare the numbers before and after. A throttled lab simulation is not a real network, and if it gets worse, removing one line of config goes back.

3. TS 7.1 beta with typescript-eslint's tsgo backend (not shipped)

typescript-eslint 8.74 is ready to use TypeScript 7's native API: installing a 7.1 beta called @typescript/native lets you switch to the experimental tsgo backend.

The result first: this project cannot use it. Reading the typescript-estree source showed that the tsgo backend is only used for "type-aware lint" (parserOptions.projectService), which this project does not enable. If you only set the environment variable TYPESCRIPT_ESLINT_EXPERIMENTAL_BACKEND=tsgo, it silently falls back to the traditional backend, and nothing changes.

So I temporarily turned on type-aware lint and added 4 rules that need type information in order to measure:

Whole-project lintTime
Current setup (no type information)11.7 s
Type-aware, traditional backend (TS 6 API)24.1 s
Type-aware, tsgo backend (TS 7.1 beta)20.0 s

tsgo was 17% faster, and both found exactly the same problems. To be sure tsgo is really on, you cannot rely on the environment variable alone: put projectService: { EXPERIMENTAL_backend: "tsgo" } in the config, and if the conditions are not met it throws an error instead of silently falling back.

The most useful by-product of this experiment was the 88 problems those 4 rules found: 19 Promises neither awaited nor error-handled, and 37 async functions passed to places that should not take them. Some of those may be real bugs, and they have been queued separately on the to-do list.

A fourth: looks like it fixes the deploy problem, but cannot be used

turbopackPluginRuntimeStrategy: 'workerThreads' can swap that Node subprocess pool for worker threads, which looks like it would sidestep the PostCSS timeout directly. But the docs say plainly: since Node 24.13.1 there is a bug when a worker thread exits, and Next detects it and falls back to the old approach automatically; forcing it on can abort the whole process. This site runs Node 26, so that route cannot be taken for now.

Type to search projects and posts too