Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow compile speed #5934

Closed
dobrac opened this issue Jun 14, 2019 · 25 comments
Closed

Slow compile speed #5934

dobrac opened this issue Jun 14, 2019 · 25 comments

Comments

@dobrac
Copy link

dobrac commented Jun 14, 2019

Version

v2.8.1

Reproduction link

https://github.com/nuxt/create-nuxt-app

Steps to reproduce

yarn create nuxt-app
yarn run build

What is expected ?

Build takes about 12-15 seconds.

What is actually happening?

Build takes 25+ seconds.

Additional comments?

I am really strugling with build times. When I for example try Next.js compilation, it only takes 12 seconds (on the first and 5 seconds after each new build) for the template to compile. Nuxt.js on the other hand takes 25 seconds and more. It takes 2x longer. I dont like it, because deployment of simple two page app takes 4+ minutes on Now.sh. I think that these speeds should be way faster.

I have also one more complicated app and the build takes 10 minutes+. And that is awful.

I have seen some advices how to cache and parallel, but neither of these made significant speed up. (I cant use cache, because it is containerized).

Is there some work towards it or are there any options, how to improve it?

This bug report is available on Nuxt community (#c9364)
@ghost ghost added the cmty:bug-report label Jun 14, 2019
@pimlie
Copy link

pimlie commented Jun 20, 2019

For me a new create-nuxt-app builds in less then 9 seconds, can you share some more details and a reproduction maybe?

@dobrac
Copy link
Author

dobrac commented Jun 21, 2019

My computer (laptop), where I measure speeds, has processor Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz with 12 GB RAM and nvme SSD. My operating system is Pop!_Os (it's a Debian distribution).

I do the test with basic npx create command. I start with the command for Nuxt.js and for Next.js. Then I try to build both apps (NOT at once). The results are consistent that Nuxt.js is 2x slower than Next.js.

For me a new create-nuxt-app builds in less then 9 seconds, can you share some more details and a reproduction maybe?

Please try to build both apps and then compare them. The differences in speed of small applications are same as of large applications. (Which makes the difference from seconds to minutes).

@halower
Copy link

halower commented Jun 27, 2019

I've looked at a lot of comments and found that a lot of people actually have this problem, but in fact so far there is no effective solution for the official, I hope to optimize, thank you

the build takes 10 minutes+. and that is awful. @dobrac

my build takes 5 minutes+,now

@stale
Copy link

stale bot commented Jul 18, 2019

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

@stale stale bot added the stale label Jul 18, 2019
@manniL
Copy link
Member

manniL commented Jul 20, 2019

A build taking so much time usually indicates either a really large application or problems in the underlying configuration/code base.

However, we are trying to improve the build and HMR time as good as we can. But a large part of it comes through the user-added dependencies

@stale stale bot removed the stale label Jul 20, 2019
@dobrac
Copy link
Author

dobrac commented Jul 20, 2019

A build taking so much time usually indicates either a really large application or problems in the underlying configuration/code base.

However, we are trying to improve the build and HMR time as good as we can. But a large part of it comes through the user-added dependencies

If it's so, why is it happening in the official Nuxt.js example?

@manniL
Copy link
Member

manniL commented Jul 20, 2019

@dobrac Feel free to point out an example that takes longer than 10 minutes to build ☺️

As @pimlie said, the default build time is ~9-11 seconds (fresh CNA app)
image

@stale
Copy link

stale bot commented Aug 10, 2019

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

@stale stale bot added the stale label Aug 10, 2019
@stale stale bot closed this as completed Aug 17, 2019
@do-web
Copy link

do-web commented Sep 11, 2019

Large HTML Dokument > 1000 lines of markup, takes up to minutes compiling! So for large html dokuments nuxt is unusable at the moment.

ℹ Preparing project for development 10:14:17
ℹ Initial build may take a while 10:14:17
✔ Builder initialized 10:14:17
✔ Nuxt files generated 10:14:17

✔ Client
Compiled successfully in 2.25m

ℹ Waiting for file changes 10:16:33
ℹ Memory usage: 399 MB (RSS: 568 MB)

@Austio
Copy link

Austio commented Sep 21, 2019

@do-web do you have an example that would reproduce this example? Would be happy to dig in and see what is going on.

@ghost
Copy link

ghost commented Oct 1, 2019

Does anyone have a solution to the same problem ?, I only use an old notebook with specifications:

CPU: Intel Atom N270
RAM: 2GB DDR2

NodeJS: v12.11.0
npm: v6.11.3

in the fresh install of create-nuxt-app, I run npm run dev and it takes more than 20 minutes to finish the compiled.

I know the problem is the limitations of the device I am using, but I hope I can get advice so that the process can run fast.

Thank you.

@Austio
Copy link

Austio commented Oct 1, 2019

That does seem unnaturally slow. My best advice would be to try on another computer as you are most likely dealing with some sort of hardware issue. We used 2gb of ram with node 8.11.1 on digitalocean and was substantially faster for the built on production mode (which does minificiation and such).

@pimlie
Copy link

pimlie commented Oct 1, 2019

@padri-zan That CPU was already slow when it was new, let alone 11 years later.

If the net/notebook has a hdd, try to see if you can use a ssd/sd card/usb as the cpu is probably also bogged with io-waits. Maybe even try to setup a ram-disk and copy your full project to it and then run it. Make the ram disk as small as possible, ~512MB should be enough hopefully depending on your project but note that ALL files on the ram-disk are lost when you unplug the power. So if you make changes on the ramdisk you have to manually copy them to the real disk as well. Use google to look for howto's of creating a ramdisk for your operating system.

But the best advise is to try to upgrade to a somewhat quicker machine

@ghost
Copy link

ghost commented Oct 1, 2019

Yes, I think it is like that, I will try on some services such as Digitalocean, GCP, etc.
which one do you think is worth considering?

@tvld
Copy link

tvld commented Jan 9, 2020

Indeed, slow to compile on XPS 15 / Core i7, 12GB RAM: 20 seconds for relatively small website with about 20 pages. Nothing weird going on and no other packages than nuxt provides.

Also seems to be slower while developing, until I get node crash due to running out of heap memory. Will keep a watch of things to see if I can improve reporting...

@slim-python
Copy link

same here, taking 15-20 seconds to compile

@caseytrombley
Copy link

This bug is closed? Why? Nuxt takes almost 20 minutes to build. A simple one line css change causes dev rebuild of 4 minutes each time. I use a brand new MacBook with 16gb memory. Not the MacBook. My app is relatively small too. I see Nuxt get hung up on string replace. This bug got closed for some reason even though it was not properly addressed.

@BR0008
Copy link

BR0008 commented Jan 3, 2021

Still the same!

@tvld
Copy link

tvld commented Jan 4, 2021

For me the issue seems to not exist when I tell Nuxt to not use SSR... Try that maybe?

@jj-dominguez
Copy link

Same problem here, and no @tvld I am using in SPA mode / ssr: false and same problems.

Has anyone had much luck in speeding things up?

@BR0008
Copy link

BR0008 commented Jan 8, 2021 via email

@tvld
Copy link

tvld commented Jan 9, 2021

@BR0008 what you mean with { components: false } ? In what part of nuxt.config.js ?

@BR0008
Copy link

BR0008 commented Jan 9, 2021 via email

@tvld
Copy link

tvld commented Jan 11, 2021

@BR0008 it says it is "false" by default; I never had a need to change that ... hmmm.. ))

@alanyong91
Copy link

Nuxt takes almost 20 minutes to build. A simple one line css change causes dev rebuild of 4 minutes each time.

And I use Macbook Pro 16GB memory too.

npm run dev tooks 3 minutes

  • i notice those files total up is huge. one page could download 20MB of js files even with code splitting.

npm run build tooks more than 5 minutes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests