Hacker News new | ask | show | jobs
by jonathanhefner 463 days ago
I have also found that Next.js is shockingly slow.

I recently added some benchmarks to the TechEmpower Web Framework Benchmarks suite, and Next.js ranked near dead last, even for simple JSON API endpoint (i.e. no React SSR involved): https://www.techempower.com/benchmarks/#section=data-r23&hw=...

I discussed it with a couple of Next.js maintainers (https://github.com/vercel/next.js/discussions/75930), and they indicated that it's only a problem for "standalone" deployments (i.e. not on Vercel). However, I'm not entirely convinced that is true. I wonder if there are major optimizations that could be made to, for example, the routing system.

3 comments

I have no particular views on performance but the thing i keep hearing about next of 'this is solved by using one particular hosting provider' really surprises me as something people are ok with.
kind of like the AWS tools only really work if you use them with Amazon Web Services...
I think people reasonably expect, say, an aws lambda to be aws specific.

That's a very different story to React, which is supposed to be a library for general application ui development, and the official react documentation recommending Next as the way to use it.

https://react.dev/learn/creating-a-react-app

I've been using React on and off since 2017 or so. Back in the day it was typical to bundle your React code and integrate it with the backend framework of your choice. It was stable and cheap. In the 2020s frontend tech took a bizarre turn...
Going through the GitHub discussion is eye-opening given that CEO of Vercel just publicly stated that Next.js is an API framework: https://x.com/rauchg/status/1895599156724711665
Is he wrong though? Next.js reason of existence is essentially that .json file navigation. The addition of server side compute (ie: middlewares, router, etc...) is mostly a business decision that the framework has nothing to do with as it breaks your back-end/front-end separation (unless your application is very simple to fit in a nextjs function).
> and they indicated that it's only a problem for "standalone" deployments (i.e. not on Vercel)

The fix is clearly to take out your wallet /not.

NextJs is slow. It doesn't have to be. For their swc, turborepo and everything else going on they could have made the actual production usage fast just as well.