pnpm / benchmarks-of-javascript-package-managers

Benchmarks of JavaScript Package Managers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Venryx opened this issue · comments

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 lodash@1.2.0: 62s (slow since had to clear yarn metadata + rebuild it)
* npm install lodash@1.2.1: 5s
* npm install lodash@1.3.0: 5s
* npm install lodash@1.3.1: 5s
* yarn add lodash@2.0.0: 48s (slow since had to clear npm metadata + rebuild it)
* yarn add lodash@2.1.0: 12s
* yarn add lodash@2.2.0: 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.

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?

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.