Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pnpm/benchmarks-of-javascript-package-managers

Benchmarks of JavaScript Package Managers
https://github.com/pnpm/benchmarks-of-javascript-package-managers

benchmark npm package-manager pnpm yarn

Last synced: 18 days ago
JSON representation

Benchmarks of JavaScript Package Managers

Awesome Lists containing this project

README

        

**The benchmarks are now available [on the pnpm website](https://r.pnpm.io/benchmarks).**

**The code that generates the benchmarks was moved [here](https://github.com/pnpm/pnpm.github.io/tree/main/benchmarks)**.

***

# Benchmarks of JavaScript Package Managers

This benchmark compares the performance of [npm](https://github.com/npm/cli), [pnpm](https://github.com/pnpm/pnpm) and [Yarn](https://github.com/yarnpkg/yarn) (both regular and PnP variant).

Here's a quick explanation of how these tests could apply to the real world:

- `clean install`: How long it takes to run a totally fresh install: no lockfile present, no packages in the cache, no `node_modules` folder.
- `with cache`, `with lockfile`, `with node_modules`: After the first install is done, the install command is run again.
- `with cache`, `with lockfile`: When a repo is fetched by a developer and installation is first run.
- `with cache`: Same as the one above, but the package manager doesn't have a lockfile to work from.
- `with lockfile`: When an installation runs on a CI server.
- `with cache`, `with node_modules`: The lockfile is deleted and the install command is run again.
- `with node_modules`, `with lockfile`: The package cache is deleted and the install command is run again.
- `with node_modules`: The package cache and the lockfile is deleted and the install command is run again.
- `update`: Updating your dependencies by changing the version in the `package.json` and running the install command again.

## Lots of Files

The app's `package.json` [here](./fixtures/alotta-files/package.json)

| action | cache | lockfile | node_modules| npm | pnpm | Yarn | Yarn PnP |
| --- | --- | --- | --- | --- | --- | --- | --- |
| install | | | | 51s | 14.4s | 39.1s | 29.1s |
| install | ✔ | ✔ | ✔ | 5.4s | 1.3s | 707ms | n/a |
| install | ✔ | ✔ | | 10.9s | 3.9s | 11s | 1.8s |
| install | ✔ | | | 33.4s | 6.5s | 26.5s | 17.2s |
| install | | ✔ | | 28.3s | 11.8s | 23.3s | 14.2s |
| install | ✔ | | ✔ | 4.6s | 1.7s | 22.1s | n/a |
| install | | ✔ | ✔ | 6.5s | 1.3s | 713ms | n/a |
| install | | | ✔ | 6.1s | 5.4s | 41.1s | n/a |
| update | n/a | n/a | n/a | 5.1s | 10.7s | 35.4s | 28.3s |

![Graph of the alotta-files results](./results/imgs/alotta-files.svg)