Next.js

Next.js: Performance Optimizations and Clean-up Day

Today we're diving into some exciting performance improvements to Next.js, including smarter argument handling for server actions and significant Turbopack persistence optimizations. The team merged 4 pull requests focused on efficiency gains, with standout contributions from Hendrik Liebau on server action optimizations and Tobias Koppers on Turbopack performance enhancements.

Duration: PT4M3S

https://podlog.io/listen/next-js-36fde2ae/episode/next-js-performance-optimizations-and-clean-up-day-eeb5cb08

Transcript

Hey there, amazing developers! Welcome back to another episode of the Next.js podcast. I'm so glad you're here with me today - grab your favorite beverage because we've got some really cool performance wins to talk about.

So February 8th was one of those satisfying days in open source where everything just clicked into place. You know those days where the team is firing on all cylinders, merging meaningful improvements left and right? That's exactly what we saw yesterday with 4 solid pull requests making their way into the codebase.

Let me start with what I think is the most developer-friendly improvement of the day. Hendrik Liebau dropped this fantastic optimization for server actions - and honestly, this is the kind of behind-the-scenes magic that makes me excited about framework development. So here's the story: you know how Next.js was already pretty smart about omitting unused arguments when you're calling cached functions from the client? Well, Hendrik extended that same intelligence to server actions.

But here's where it gets really clever - instead of just skipping unused arguments, the optimization now trims trailing unused arguments from the array entirely. That means instead of sending undefined values across the network, we're sending literally nothing for those unused parameters. It's one of those changes that sounds small but adds up to real performance gains, especially when you're dealing with lots of server actions in your app.

Now, speaking of performance, Tobias Koppers has been on an absolute tear with Turbopack optimizations lately. He merged not one, but two improvements to the persistence layer that are pretty fascinating from an engineering perspective. The big one removes the AMQF cache entirely and stores everything in memory instead. I know that might sound counterintuitive - wouldn't storing everything in memory use more resources? But here's the thing: Tobias discovered that when AMQF isn't available, performance tanks significantly. So by ensuring it's always cached in memory, even though it uses more RAM, the overall experience is way faster.

The benchmarks tell an incredible story too. For smaller datasets, performance stayed roughly the same, but for larger applications - and I'm talking about really large codebases here - they're seeing 3 to 4 times faster performance in some cases. That's the difference between a sluggish development experience and a snappy one.

Tobias also cleaned up some redundant benchmarks that were essentially duplicating cached variants. I love these kinds of maintenance PRs because they show a team that cares about code quality and developer experience, not just shipping features.

And then we have JJ Kasper tackling one of those annoying flaky tests that probably made a bunch of developers scratch their heads when CI randomly failed. It was a simple version bump for the Vercel CLI in a deployment test, but these fixes matter so much for team productivity.

The day wrapped up with the release of version 16.2.0-canary.31, which means all these improvements are now available for you to try out if you're running on the canary channel.

What really strikes me about this batch of changes is how they represent different types of care - care for performance, care for developer experience, and care for code maintainability. These aren't flashy new features that make for exciting blog posts, but they're the foundation that makes Next.js such a joy to work with.

Today's Focus: If you're working with server actions in your Next.js app, this is a perfect time to audit how you're passing arguments. Even though the framework is now smarter about optimizing unused parameters, being intentional about your function signatures is still good practice. And if you're on a larger project, definitely consider trying out the canary build to experience these Turbopack improvements firsthand.

That's a wrap for today's episode! Keep building awesome things, and I'll catch you tomorrow with more Next.js updates. Until then, happy coding!