I am trying to see how much time npm install
takes to complete installing all my dependencies. Is there a way for me to time this process, natively (in npm) or using some third party plugin? I've tried
* npm i --verbose
* npm i --silly
* slow-deps
(A third party lib that analyzes your npm packages)
slow-deps
gave me a decent result, but I am not sure about it's accuracy, as it doesn't run as part of the npm install
process.
Is there any other way to accurately time-profile the npm install
process? I'm looking for an output like this (output screenshot from Yarn):
npm install : 4.1 minutes per run. yarn : 2 minutes for the first run and 1 minute for subsequent runs.
npm install simply reads your package. json file, fetches the packages listed there from (usually) https://www.npmjs.com/ , and sometimes engages in the build steps for those packages. So you only have to run npm install when you change your package. json file, and need to fetch new dependencies.
Thanks for your help. I have come across a few utilities for this:
time
utility mentioned by @JJJ in the comments section.gnomon
package, that updates timestamps to everything.Use time
linux command and have the following command:
time npm install
Also according to https://www.commandlinux.com/man-page/man1/time.1.html
Users of the bash shell need to use an explicit path in order to run the external time command and not the shell builtin variant.
so your command may be (I am a macOS user and I am using the below command):
/usr/bin/time npm install
The output of this command (at the last line) would be something like this:
153.96 real 67.63 user 34.12 sys
so basically what you are looking at is the real
number that are in seconds. To the above example the time taken is:
153.96s
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With