Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 45 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -20,15 +20,15 @@ The app's `package.json` [here](./fixtures/react-app/package.json)

| action | cache | lockfile | node_modules| npm | pnpm | Yarn | Yarn PnP |
Copy link
Member

@zkochan zkochan Feb 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to rename the columns to Yarn 1 and Yarn 2. But to be honest, why not just run the performance tests for Yarn 2 and name it "Yarn"? Why do we need to include Yarn 1 in the benchmarks?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still valuable given that many people will only migrate over time. Plus, since 1.x and 2.x are quite different implementations with different tradeoffs, it gives a nice way to see the impact of the choices we made, one way or another.

| --- | --- | --- | --- | --- | --- | --- | --- |
| install | | | | 24.7s | 18.1s | 20.2s | 15.9s |
| install | ✔ | ✔ | ✔ | 6.8s | 1.5s | 860ms | n/a |
| install | ✔ | ✔ | | 16.1s | 6.9s | 5.6s | 1.8s |
| install | ✔ | | | 22.9s | 11.4s | 10s | 6.2s |
| install | | ✔ | | 20.1s | 16.7s | 14.3s | 10.7s |
| install | ✔ | | ✔ | 7.4s | 2s | 8.2s | n/a |
| install | | ✔ | ✔ | 7.3s | 1.4s | 834ms | n/a |
| install | | | ✔ | 7.4s | 4.5s | 20.9s | n/a |
| update | n/a | n/a | n/a | 7.6s | 16s | 22.9s | 16.1s |
| install | | | | 23.4s | 22.9s | 17.1s | 22.1s |
| install | ✔ | ✔ | ✔ | 6.6s | 1.4s | 641ms | 1.1s |
| install | ✔ | ✔ | | 14.7s | 7.1s | 4.4s | 2.3s |
| install | ✔ | | | 20.6s | 11.7s | 8.6s | 9.8s |
| install | | ✔ | | 18s | 19.3s | 12.3s | 15s |
| install | ✔ | | ✔ | 6.4s | 1.9s | 7.7s | 5.4s |
| install | | ✔ | ✔ | 6.6s | 1.4s | 673ms | 14.2s |
| install | | | ✔ | 6.5s | 4.5s | 18.2s | 17.1s |
| update | n/a | n/a | n/a | 6.7s | 19.2s | 19.1s | 24.2s |

![Graph of the react-app results](./results/imgs/react-app.svg)

@@ -38,15 +38,15 @@ The app's `package.json` [here](./fixtures/ember-quickstart/package.json)

| action | cache | lockfile | node_modules| npm | pnpm | Yarn | Yarn PnP |
| --- | --- | --- | --- | --- | --- | --- | --- |
| install | | | | 22s | 16.2s | 19.5s | 14.8s |
| install | ✔ | ✔ | ✔ | 5.9s | 1.3s | 694ms | n/a |
| install | ✔ | ✔ | | 12.2s | 5.8s | 4.9s | 1.7s |
| install | ✔ | | | 16.9s | 9.6s | 10.4s | 7s |
| install | | ✔ | | 14.9s | 15.3s | 12.7s | 10s |
| install | ✔ | | ✔ | 5.8s | 1.4s | 8.5s | n/a |
| install | | ✔ | ✔ | 6s | 1.3s | 686ms | n/a |
| install | | | ✔ | 6.1s | 2.6s | 17.1s | n/a |
| update | n/a | n/a | n/a | 6.1s | 14.2s | 19.9s | 12.2s |
| install | | | | 20.3s | 19.4s | 18.9s | 33.6s |
| install | ✔ | ✔ | ✔ | 5.3s | 1.2s | 501ms | 1.1s |
| install | ✔ | ✔ | | 11s | 5.8s | 3.6s | 2.5s |
| install | ✔ | | | 15.2s | 9.6s | 9s | 8.6s |
| install | | ✔ | | 13.6s | 17s | 10.3s | 16.5s |
| install | ✔ | | ✔ | 5.2s | 1.4s | 7.2s | 3.9s |
| install | | ✔ | ✔ | 5.4s | 1.3s | 500ms | 14.9s |
| install | | | ✔ | 5.3s | 2.4s | 17.3s | 17.5s |
| update | n/a | n/a | n/a | 5.6s | 16.9s | 15.3s | 18.4s |

![Graph of the ember-quickstart results](./results/imgs/ember-quickstart.svg)

@@ -56,15 +56,15 @@ The app's `package.json` [here](./fixtures/angular-quickstart/package.json)

| action | cache | lockfile | node_modules| npm | pnpm | Yarn | Yarn PnP |
| --- | --- | --- | --- | --- | --- | --- | --- |
| install | | | | 7.4s | 24.1s | 26.9s | 23.2s |
| install | ✔ | ✔ | ✔ | 7.8s | 1.6s | 834ms | n/a |
| install | ✔ | ✔ | | 21s | 8.6s | 7.5s | 1.9s |
| install | ✔ | | | 24.9s | 13s | 14.1s | 7.8s |
| install | | ✔ | | 21s | 21.5s | 20s | 15.2s |
| install | ✔ | | ✔ | 7.1s | 3.6s | 9.8s | n/a |
| install | | ✔ | ✔ | 7.3s | 1.5s | 750ms | n/a |
| install | | | ✔ | 7.3s | 9.5s | 25.8s | n/a |
| update | n/a | n/a | n/a | 7.4s | 16.8s | 20.4s | 13.3s |
| install | | | | 12.2s | 29.3s | 22.8s | 1m 5.9s |
| install | ✔ | ✔ | ✔ | 6.9s | 1.5s | 581ms | 1.7s |
| install | ✔ | ✔ | | 18.3s | 8.9s | 5.8s | 3.1s |
| install | ✔ | | | 22.1s | 13.5s | 13.1s | 11.1s |
| install | | ✔ | | 19.3s | 24.6s | 16.3s | 34.4s |
| install | ✔ | | ✔ | 6.3s | 3.3s | 8.6s | 6.2s |
| install | | ✔ | ✔ | 6.6s | 1.5s | 535ms | 32.4s |
| install | | | ✔ | 6.4s | 9.4s | 23.5s | 35.2s |
| update | n/a | n/a | n/a | 6.6s | 20.1s | 17.5s | 42.5s |

![Graph of the angular-quickstart results](./results/imgs/angular-quickstart.svg)

@@ -74,15 +74,15 @@ The app's `package.json` [here](./fixtures/medium-size-app/package.json)

| action | cache | lockfile | node_modules| npm | pnpm | Yarn | Yarn PnP |
| --- | --- | --- | --- | --- | --- | --- | --- |
| install | | | | 25.5s | 20s | 25.5s | 20.7s |
| install | ✔ | ✔ | ✔ | 6.4s | 1.4s | 733ms | n/a |
| install | ✔ | ✔ | | 14.5s | 6.9s | 6.2s | 1.8s |
| install | ✔ | | | 20s | 10.9s | 15.3s | 10.5s |
| install | | ✔ | | 18.4s | 18s | 16.1s | 12.3s |
| install | ✔ | | ✔ | 6.5s | 2.7s | 12.9s | n/a |
| install | | ✔ | ✔ | 6.7s | 1.3s | 702ms | n/a |
| install | | | ✔ | 6.9s | 7s | 25.5s | n/a |
| update | n/a | n/a | n/a | 6.7s | 13.7s | 24.3s | 20.6s |
| install | | | | 23.7s | 23.5s | 22.8s | 49.5s |
| install | ✔ | ✔ | ✔ | 5.8s | 1.6s | 490ms | 1.6s |
| install | ✔ | ✔ | | 13.2s | 7.4s | 4.3s | 3.1s |
| install | ✔ | | | 18.6s | 11.6s | 12.6s | 10.8s |
| install | | ✔ | | 16.7s | 19.9s | 13.3s | 26.7s |
| install | ✔ | | ✔ | 5.8s | 2.4s | 9.7s | 5.1s |
| install | | ✔ | ✔ | 6.1s | 1.3s | 486ms | 23.8s |
| install | | | ✔ | 6.1s | 7.1s | 21.5s | 29.6s |
| update | n/a | n/a | n/a | 6.1s | 16.3s | 15.2s | 32.3s |

![Graph of the medium-size-app results](./results/imgs/medium-size-app.svg)

@@ -92,14 +92,14 @@ The app's `package.json` [here](./fixtures/alotta-files/package.json)

| action | cache | lockfile | node_modules| npm | pnpm | Yarn | Yarn PnP |
| --- | --- | --- | --- | --- | --- | --- | --- |
| install | | | | 6.6s | 22.4s | 35s | 42.7s |
| install | ✔ | ✔ | ✔ | 7.4s | 1.6s | 810ms | n/a |
| install | ✔ | ✔ | | 21.8s | 7.5s | 10.7s | 2.1s |
| install | ✔ | | | 33s | 12.3s | 22.2s | 18.2s |
| install | | ✔ | | 22.3s | 18.4s | 22.2s | 13s |
| install | ✔ | | ✔ | 7s | 3.5s | 15.6s | n/a |
| install | | ✔ | ✔ | 6.8s | 1.5s | 787ms | n/a |
| install | | | ✔ | 6.5s | 7.5s | 32.2s | n/a |
| update | n/a | n/a | n/a | 6.8s | 16.9s | 34.1s | 25s |
| install | | | | 13.5s | 26.4s | 37.5s | 42s |
| install | ✔ | ✔ | ✔ | 6.6s | 1.5s | 558ms | 1.4s |
| install | ✔ | ✔ | | 19s | 7.6s | 7.4s | 3s |
| install | ✔ | | | 28.2s | 12.7s | 17.8s | 10.6s |
| install | | ✔ | | 20.2s | 21s | 16.5s | 22.2s |
| install | ✔ | | ✔ | 6.1s | 3.3s | 13.3s | 5.4s |
| install | | ✔ | ✔ | 6.2s | 1.5s | 511ms | 19.6s |
| install | | | ✔ | 5.7s | 7.4s | 28.3s | 22.9s |
| update | n/a | n/a | n/a | 6.2s | 19.5s | 25.8s | 50.9s |

![Graph of the alotta-files results](./results/imgs/alotta-files.svg)
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -123,13 +123,13 @@ async function run () {
| action | cache | lockfile | node_modules| npm | pnpm | Yarn | Yarn PnP |
| --- | --- | --- | --- | --- | --- | --- | --- |
| install | | | | ${prettyMs(npmRes.firstInstall)} | ${prettyMs(pnpmRes.firstInstall)} | ${prettyMs(yarnRes.firstInstall)} | ${prettyMs(yarnPnPRes.firstInstall)} |
| install | ✔ | ✔ | ✔ | ${prettyMs(npmRes.repeatInstall)} | ${prettyMs(pnpmRes.repeatInstall)} | ${prettyMs(yarnRes.repeatInstall)} | n/a |
| install | ✔ | ✔ | ✔ | ${prettyMs(npmRes.repeatInstall)} | ${prettyMs(pnpmRes.repeatInstall)} | ${prettyMs(yarnRes.repeatInstall)} | ${prettyMs(yarnPnPRes.repeatInstall)} |
| install | ✔ | ✔ | | ${prettyMs(npmRes.withWarmCacheAndLockfile)} | ${prettyMs(pnpmRes.withWarmCacheAndLockfile)} | ${prettyMs(yarnRes.withWarmCacheAndLockfile)} | ${prettyMs(yarnPnPRes.withWarmCacheAndLockfile)} |
| install | ✔ | | | ${prettyMs(npmRes.withWarmCache)} | ${prettyMs(pnpmRes.withWarmCache)} | ${prettyMs(yarnRes.withWarmCache)} | ${prettyMs(yarnPnPRes.withWarmCache)} |
| install | | ✔ | | ${prettyMs(npmRes.withLockfile)} | ${prettyMs(pnpmRes.withLockfile)} | ${prettyMs(yarnRes.withLockfile)} | ${prettyMs(yarnPnPRes.withLockfile)} |
| install | ✔ | | ✔ | ${prettyMs(npmRes.withWarmCacheAndModules)} | ${prettyMs(pnpmRes.withWarmCacheAndModules)} | ${prettyMs(yarnRes.withWarmCacheAndModules)} | n/a |
| install | | ✔ | ✔ | ${prettyMs(npmRes.withWarmModulesAndLockfile)} | ${prettyMs(pnpmRes.withWarmModulesAndLockfile)} | ${prettyMs(yarnRes.withWarmModulesAndLockfile)} | n/a |
| install | | | ✔ | ${prettyMs(npmRes.withWarmModules)} | ${prettyMs(pnpmRes.withWarmModules)} | ${prettyMs(yarnRes.withWarmModules)} | n/a |
| install | ✔ | | ✔ | ${prettyMs(npmRes.withWarmCacheAndModules)} | ${prettyMs(pnpmRes.withWarmCacheAndModules)} | ${prettyMs(yarnRes.withWarmCacheAndModules)} | ${prettyMs(yarnPnPRes.withWarmCacheAndModules)} |
| install | | ✔ | ✔ | ${prettyMs(npmRes.withWarmModulesAndLockfile)} | ${prettyMs(pnpmRes.withWarmModulesAndLockfile)} | ${prettyMs(yarnRes.withWarmModulesAndLockfile)} | ${prettyMs(yarnPnPRes.withWarmModulesAndLockfile)} |
| install | | | ✔ | ${prettyMs(npmRes.withWarmModules)} | ${prettyMs(pnpmRes.withWarmModules)} | ${prettyMs(yarnRes.withWarmModules)} | ${prettyMs(yarnPnPRes.withWarmModules)} |
| update | n/a | n/a | n/a | ${prettyMs(npmRes.updatedDependencies)} | ${prettyMs(pnpmRes.updatedDependencies)} | ${prettyMs(yarnRes.updatedDependencies)} | ${prettyMs(yarnPnPRes.updatedDependencies)} |

![Graph of the ${fixture.name} results](./results/imgs/${fixture.name}.svg)
21 changes: 18 additions & 3 deletions lib/benchmarkFixture.js
Original file line number Diff line number Diff line change
@@ -8,10 +8,11 @@ const readFile = thenify(require('fs').readFile)
const writeFile = thenify(require('fs').writeFile)
const getFolderSize = thenify(require('get-folder-size'))
const rimraf = require('rimraf').sync
const tmpdir = require('os').tmpdir

const BASEDIR = path.join(__dirname, '..')
const FIXTURES_DIR = path.join(BASEDIR, 'fixtures')
const TMP = path.join(BASEDIR, '.tmp')
const TMP = path.join(tmpdir(), 'pm-bench')

const lockfileNameByPM = {
npm: 'package-lock.json',
@@ -57,7 +58,11 @@ async function updateDependenciesInPackageJson (cwd) {
module.exports = async function benchmark (pm, fixture, opts) {
const cwd = path.join(TMP, pm.scenario, fixture)
await copy(path.join(FIXTURES_DIR, fixture), cwd)
const modules = opts.hasNodeModules ? path.join(cwd, 'node_modules') : null
const modules = opts.hasNodeModules ? path.join(cwd, 'node_modules') : path.join(cwd, '.pnp.js')

console.log(`# preparing ${cwd}`)

await setupPm(pm, cwd)

console.log(`# first install`)

@@ -154,11 +159,21 @@ module.exports = async function benchmark (pm, fixture, opts) {
}
}

function setupPm (cmd, cwd) {
for (const line of cmd.setup || []) {
console.log(`> ${line}`)
const result = child.spawnSync(line, {env, cwd, shell: true, stdio: 'inherit'})
if (result.status !== 0) {
throw new Error(`${cmd.name} failed with status code ${result.status}`)
}
}
}

function measureInstall (cmd, cwd) {
const startTime = Date.now()

console.log(`> ${cmd.name} ${cmd.args.join(' ')}`)
const result = child.spawnSync(cmd.name, cmd.args, {env, cwd, stdio: 'inherit'})
const result = child.spawnSync(cmd.name, cmd.args, {env: {...env, ...cmd.env}, cwd, stdio: 'inherit'})
if (result.status !== 0) {
throw new Error(`${cmd.name} failed with status code ${result.status}`)
}
15 changes: 10 additions & 5 deletions lib/commandsMap.js
Original file line number Diff line number Diff line change
@@ -41,13 +41,18 @@ module.exports = {
},
yarn_pnp: {
scenario: 'yarn_pnp',
legend: "Yarn PnP",
legend: "Yarn 2",
name: 'yarn',
setup: [
'touch yarn.lock',
'yarn set version berry',
],
env: {
YARN_CACHE_FOLDER: 'cache/cache',
YARN_GLOBAL_FOLDER: 'cache/global',
YARN_ENABLE_SCRIPTS: '0'
},
args: [
'--pnp',
'--ignore-scripts',
'--cache-folder',
'cache'
]
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@
"rimraf": "^2.5.4",
"thenify": "^3.2.1",
"write-yaml-file": "^1.0.0",
"yarn": "^1.21.1"
"yarn": "^1.22.0"
},
"devDependencies": {
"standard": "^10.0.2"
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Oops, something went wrong.