benchmarks-of-javascript-package-managers icon indicating copy to clipboard operation
benchmarks-of-javascript-package-managers copied to clipboard

Add time taken to add a new module (eg. npm install XXX)

Open Venryx opened this issue 6 years ago • 2 comments
trafficstars

It would be nice if the benchmark also tracked how long it took to install (ie. add) modules, after the project has already been fully installed/initialized.

This is an important consideration, since it's the most common dependency-related operation that is performed (at least in my projects).

It's also significant because npm is actually faster than yarn for adding new modules -- at least for my project, with a package-lock present for both:

These commands were done in order, in the "mobx-devtools-advanced" repo, on 2019-11-13.

NPM version: 6.11.2
Yarn version: 1.19.1

* npm install [email protected]: 62s (slow since had to clear yarn metadata + rebuild it)
* npm install [email protected]: 5s
* npm install [email protected]: 5s
* npm install [email protected]: 5s
* yarn add [email protected]: 48s (slow since had to clear npm metadata + rebuild it)
* yarn add [email protected]: 12s
* yarn add [email protected]: 10s
* npm install lodash @2.0.0: 67s (slow again due to rebuild)
* npm install lodash @2.1.0: 5s
* npm install lodash @2.2.0: 5s

Note that the operation of just adding a new module took about half as long for npm than yarn.

That said, both are quite fast, so perhaps it's not so important after all.

Venryx avatar Nov 13 '19 10:11 Venryx

So if I understand you correctly:

  • install all dependencies
  • add new dependencies to package.json
  • run install command again and measure the time it took to install the new dependencies

This could be added as a new test after line 142 of benchmarkFixture.js. Are you willing to open up a PR for this?

nikoladev avatar Nov 13 '19 12:11 nikoladev

I actually meant:

  • install all dependencies
  • add new dependencies using "npm install XXX" command (or "yarn add XXX"), measuring the time it took to install the new dependencies

However, maybe the above is equivalent behind the scenes to what you described. (I don't know that detail of npm and yarn behavior)

This could be added as a new test after line 142 of benchmarkFixture.js. Are you willing to open up a PR for this?

I don't have time to make a PR right now; I was just mentioning it here as a potential improvement for the future. If you dislike it cluttering the issues list, feel free to close. Just wanted to bring the suggestion up, and record it in an issue for easy referencing.

Venryx avatar Nov 14 '19 03:11 Venryx