Next.js: Turbopack Gets a Major Performance Overhaul
The Next.js team delivered some serious Turbopack performance wins, with a massive 23% speed boost in JavaScript analysis and several architectural improvements. Key contributions came from mmastrac with compile-time optimizations, mischnic with memory efficiency improvements, and acdlite fixing a scroll restoration bug that was frustrating users.
Duration: PT3M51S
Transcript
Hey there, fellow developers! Welcome back to another episode of the Next.js podcast. I'm your host, and I've got my coffee ready because we're diving into some really exciting stuff that happened yesterday, March 14th.
You know those days when you can just feel the momentum building? Yesterday was absolutely one of those days for the Next.js team. We saw six solid pull requests get merged, and let me tell you - these weren't just small tweaks. We're talking about some serious performance improvements that are going to make your development experience noticeably better.
Let's start with the star of the show. Niklas Mischkulnig just delivered a 23% performance boost to Turbopack's JavaScript analysis. Twenty-three percent! That's the kind of improvement you actually feel in your daily workflow. The secret sauce here was brilliantly simple - most imports don't have special attributes like `import ... with` syntax or webpack comments, so why store space for them in every single import? By moving those rare attributes behind a pointer, the memory layout became way more efficient, and boom - everything runs faster.
But wait, there's more performance goodness. Matt Mastracci has been on this incredible mission to make Turbopack's registration code compile-time optimized, and his latest pull request is a masterpiece. He's moved a huge chunk of the task registration system to use `const` declarations, which means vtable lookups happen at compile time instead of runtime. The result? One to three percent speedup across the board, plus faster startup times. It's like giving your build process a shot of espresso.
Now, here's a change that's going to save some headaches. Andrew Clark tackled this annoying bug where calling `refresh()` from a server action would scroll your page back to the top. Super frustrating when you're trying to update data and suddenly you're looking at the header again! He completely reimagined how scroll restoration works, moving from this complex segment-path-matching system to a much cleaner shared reference model. Sometimes the best fixes are the ones that make the code simpler while solving real user pain points.
The team also added some nice quality-of-life improvements. You can now use `require()` with Turbopack chunking hints - so if you're in a CommonJS environment, you're not left out of the chunking optimization party. Plus, there's better error messaging when you get the syntax wrong, which is always appreciated.
And speaking of optimizations, Tobias Koppers implemented this clever keyed cell access system for async module information. Instead of invalidating everything when one module changes its async status, the system now only invalidates the specific parts that care about that particular module. It's like having a smart notification system that only bothers you about changes you actually care about.
Oh, and they enabled thin Link Time Optimization for release builds. This is one of those behind-the-scenes improvements that makes the final Next.js binaries faster without adding build time overhead. Your production apps are going to love this.
What I really love about this batch of changes is how they show the full spectrum of great engineering - from micro-optimizations that add up to big wins, to architectural improvements that prevent entire classes of problems, to user experience fixes that just make things work the way you expect them to.
Today's Focus: If you're working with Turbopack, now's a great time to update and feel that performance boost in action. And if you've been hitting that scroll restoration bug with server actions, you can finally breathe easy knowing it's fixed. These improvements are already in the canary builds, so you can start benefiting from them today.
That's a wrap on today's episode! The Next.js team continues to prove that performance and developer experience can both win at the same time. Keep building amazing things, and I'll catch you tomorrow for more Next.js updates. Happy coding!