aboutsummaryrefslogtreecommitdiff
path: root/bench/install/README.md
blob: 42739a1aa4c47854561a67fbc9bc5bade41289a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# `install` benchmark

Requires [`hyperfine`](https://github.com/sharkdp/hyperfine). The goal of this benchmark is to compare installation performance of Bun with other package managers _when caches are hot_.

### With lockfile, online mode

To run the benchmark with the standard "install" command for each package manager:

```sh
$ hyperfine --prepare 'rm -rf node_modules' --warmup 1 --runs 3 'bun install' 'pnpm install' 'yarn' 'npm install'
```

### With lockfile, offline mode

Even though all packages are cached, some tools may hit the npm API during the version resolution step. (This is not the same as re-downloading a package.) To entirely avoid network calls, the other package managers require `--prefer-offline/--offline` flag. To run the benchmark using "offline" mode:

```sh
$ hyperfine --prepare 'rm -rf node_modules' --runs 1 'bun install' 'pnpm install --prefer-offline' 'yarn --offline' 'npm install --prefer-offline'
```

### Without lockfile, offline mode

To run the benchmark with offline mode but without lockfiles:

```sh
$ hyperfine --prepare 'rm -rf node_modules' --warmup 1 'rm bun.lockb && bun install' 'rm pnpm-lock.yaml && pnpm install --prefer-offline' 'rm yarn.lock && yarn --offline' 'rm package-lock.json && npm install --prefer-offline'
```

##

To check that the app is working as expected:

```
$ bun run dev
$ npm run dev
$ yarn dev
$ pnpm dev
```

Then visit [http://localhost:3000](http://localhost:3000).