Next 12 Build Performance on Windows
See original GitHub issueWhat version of Next.js are you using?
12.0.2 and 12.0.3-canary.9
What version of Node.js are you using?
v14.15.4
What browser are you using?
Any
What operating system are you using?
Windows
How are you deploying your application?
N/A
Describe the Bug
Despite the announcement (https://nextjs.org/blog/next-12#faster-builds-and-fast-refresh-with-rust-compiler) the build time of Next12 app on Windows was not improved:
- empty application created with
create-next-app@latest
- the build is the same comparing tocreate-next-app@11
(approx. 7.8 seconds) - small-size application (5 pages, 2 API endpoints) - the build is ~50% slower after updating with
npm i next@latest
by 50% (22.4s vs 32.0)
Upgrading to next@canary
makes no difference.
Others have reported similar or even worse results: https://www.tpjnorton.com/blog/posts/next-js-12-performance-test-builds-appear-to-be-slower-not-faster
Expected Behavior
Faster build with next12 comparing to next11.
To Reproduce
In Windows Powershell run:
npx create-next-app@latest
cd app-name
Measure-Command {npm run build}
Measure-Command {npm run build}
Compare results with:
npx create-next-app@11
cd app-name
Measure-Command {npm run build}
Measure-Command {npm run build}
Both build commands (with cold and hot cache) execution times are +/- the same.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:22 (8 by maintainers)
Top Results From Across the Web
Next.js 12 Performance Test: Builds Appear to ... - Tom Norton
With the exception of the starter app, all the builds with Next.js 12 are slower than with Next 11. I'm extremely surprised. For...
Read more >Best practices to increase the speed for Next.js apps
Following these best practices will help you take advantage of those features so you can start building faster Next.js applications. Tags: next.
Read more >Next.js 12 Performance Test: Builds Appear to be ... - Reddit
Some years ago I worked with a big java app, and compiling it with the same version of java was slower on windows...
Read more >next.js build times are slow. How can I make them faster?
The most recent versions of Next.js (11, and 12) have large performance improvements to start-up time, hot reloading, and compilation. And they ...
Read more >Install Next.js on Windows | Microsoft Learn
Install Windows Subsystem for Linux (WSL), including a Linux distribution (like Ubuntu) and make sure it is running in WSL 2 mode. You...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seeing slower build times (30% increase) for a medium application after upgrading to Next 12.0.3 on Mac OS too.
Cold build times (with
next build
and type checking disabled)Observed on CI too:
App
next-transpile-modules
for one 200KB dependencynext-with-less
~ I’ve removed this plugin and still observing ~10 second increaseWould a build trace help provide more visibility? Happy to share privately with a maintainer.
This also “solved” my problem. I’m on Window 10 too so you might have found the pattern.
The documentation on
outputFileTracing: false
make it sound scary to disable this, like the build could be missing files and not work… Should I be worried?@timneutkens While my repo is private, I could send an invite for you to check it out if you still need examples of real repos. Furthermore, I’m in the midst of migrating from
11.1.2
to12.0.7
so I could easily make 2 branches for testing purpose:nextjs-11-1-2
andnextjs-12-0-7
.Let me know if it’s something that you’re interested in validating.
Results of
yarn build
11.1.2
Cold build:
~25s
Warm build:~14s
12.0.7
Cold build:
~35s
(+10s average) Warm build:~24s
(+10s average)12.0.7 +
outputFileTracing: false
Cold build:
~19s
(-6s average vs 11.1.2) Warm build:~10s
(-4s average vs 11.1.2)