-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
How can I improve the build speed of node js? #35888
Comments
Hi, thanks for the report. Sorry, but you will just need a beefier PC to build Node faster. A good multi-core CPU and an NVME drive will do wonders. The first, clean build is exceptionally hard, subsequent ones should be faster though. That said, there is indeed a regression in Node build files introduced in #32698. You can try building this commit (one before the change): b79829c. Depending on your configuration, it should be slightly faster. |
Opened an issue with this regression: #35921, @ViniDalvino thanks for bringing this up to our attention! |
In the long term, we will probably switch to a better build system, see nodejs/TSC#901. Unfortunately, building Node.js with its dependencies is super slow, especially on Windows. As @bzoz wrote, only the first build should take hours, and subsequent incremental builds should complete within minutes. |
@ViniDalvino out of curiosity are you using the |
@devsnek it's not a valid command line option. I think msvc multithread the build automatically anyway |
Yeah, That said, @ViniDalvino you will still need a better PC. I have a hunch that even with this change it will take ~1h to build Node on your box - you can test that by checking out my PR code and running |
That should only be true for a complete rebuild, and incremental builds should be much faster. If incremental builds take ~1h on any modern hardware, that's on us or on the build tools. @ViniDalvino I have developed on terribly slow machines in the past, and based on my own experience, I would suggest considering using Linux for Node.js development. I developed Node.js on Windows for a long time, but it cannot really compete with development on Linux for me. I should probably just buy a better computer as suggested above, but things are much smoother on Linux than on Windows. |
Would node need to be built through the solution in visual studio in order to be quick? What I mean is that if you compile node through visual studio you can select what you compile; As example don't have to compile v8 everytime. |
You can try and use the Windows task manager to check CPU and memory utilization. CPU utilization should be close to 100% during compilation if everything is working correctly. |
@tniessen The CPU usage seem fine. |
Any chance we can bring ninja on windows ? cc @nodejs/gyp The increment build on windows still unbearable. |
Sorry for the necrobump, I'm compiling nodejs on Gentoo linux and seriously, it takes looong time and lots of ram to compile. I've ended using ccache to speed it up because on my laptop it takes up to 2 hours (yes, my laptop is a complete pain). Do you have any other suggestion too? |
I don't have any but thanks for suggesting ccache for improving build speed @scardracs +1 |
Is there a way to avoid compiling the |
@aleclarson Yes, there is a build flag that can be used for that (as per BUILDING.md): $ ./configure --node-builtin-modules-path $(pwd) |
This issue had no activity in the last two and a half years, so I'll close it. Feel free to reopen it, or open a new issue if needed. |
I was playing with the code source of node however I find the build speed really slow(1h30m). Is there any way I can improove the build speed of node js?
My compiler is msvc
The text was updated successfully, but these errors were encountered: