question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next 12 Build Performance on Windows

See original GitHub issue

What 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 to create-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:open
  • Created 2 years ago
  • Reactions:9
  • Comments:22 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
jamsinclaircommented, Nov 8, 2021

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)

  • Next 11.1.0 ~30 seconds on MacOS Mojave
  • Next 12.0.3 ~39 seconds on MacOS Mojave

Observed on CI too:

  • Next 11.1.0 ~50 seconds on Ubuntu latest (GitHub Action CI)
  • Next 12.0.3 ~64 seconds on Ubuntu latest (GitHub Action CI)

App

  • 6 API Routes
  • 2 base ISR Pages (hundreds of pages are later dynamically generated from here)
  • Uses TypeScript
  • Uses next-transpile-modules for one 200KB dependency
  • ~Uses next-with-less~ I’ve removed this plugin and still observing ~10 second increase

Would a build trace help provide more visibility? Happy to share privately with a maintainer.

1reaction
TheThirdRacecommented, Dec 19, 2021

outputFileTracing: false

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 to 12.0.7 so I could easily make 2 branches for testing purpose: nextjs-11-1-2 and nextjs-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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found