Open trivikr opened 2 years ago
Verifying https://github.com/yarnpkg/berry/pull/4036, and several other perf fixes in v3.2.0-rc.14
node-modules
linker since it doesn't use it.Verifying https://github.com/yarnpkg/berry/pull/4101, published in v3.2.0-rc.16
Numbers for v4.0.0
Discussed in https://github.com/yarnpkg/berry/discussions/4023
Screenshot
![gcb3izi3lwc7pcnqtxxy](https://user-images.githubusercontent.com/16024985/151236171-0e28179b-0061-4ae8-a0fb-73aac2d7bf0f.png)Describe the user story
As a customer of yarn, I do not want yarn to make significantly more number of system calls as compared to other package managers.
When tested with node_modules + central store mode, yarn@3.1.1 makes ~3X syscalls as compared to pnpm. This is discussed prior in https://github.com/yarnpkg/berry/discussions/4023, and on Discord thread.
System information
```console $ hostnamectl ... Operating System: Amazon Linux 2 CPE OS Name: cpe:2.3:o:amazon:amazon_linux:2:-:internal Kernel: Linux 5.4.172-100.336.amzn2int.x86_64 Architecture: x86-64 $ node -v v16.13.2 $ npm init vite@2.7.2 ✔ Project name: … vite-project ✔ Select a framework: › vue ✔ Select a variant: › vue-ts $ cd vite-project && git init && git add. && git commit -am "Initial commit" ```yarn v3.1.1: cold - 221068, warm - 37702
```console $ git clean -dfx && git checkout . $ yarn set version stable ➤ YN0000: Retrieving https://repo.yarnpkg.com/3.1.1/packages/yarnpkg-cli/bin/yarn.js ➤ YN0000: Saving the new release in .yarn/releases/yarn-3.1.1.cjs ➤ YN0000: Done in 0s 353ms $ sed -i -e 's/^/compressionLevel: 0\nenableGlobalCache: true\nnodeLinker: node-modules\nnmMode: hardlinks-global\n\n/' .yarnrc.yml $ yarn --version 3.1.1 $ time strace -c -f yarn ... % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- ... ------ ----------- ----------- --------- --------- ---------------- 100.00 35.051901 221068 13692 total strace -c -f yarn 4.33s user 3.58s system 147% cpu 5.354 total $ time strace -c -f yarn ... % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- ... ------ ----------- ----------- --------- --------- ---------------- 100.00 5.470758 37702 3699 total strace -c -f yarn 1.26s user 0.62s system 152% cpu 1.235 total ```pnpm v6.29.1: cold - 74734, warm - 28430
```console $ git clean -dfx && git checkout . $ echo 'node-linker=hoisted' > .npmrc $ pnpm --version 6.29.1 $ time strace -c -f pnpm install ... % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- ... ------ ----------- ----------- --------- --------- ---------------- 100.00 4.355469 74734 8987 total strace -c -f pnpm install 1.75s user 1.03s system 117% cpu 2.368 total $ time strace -c -f pnpm install ... % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- ... ------ ----------- ----------- --------- --------- ---------------- 100.00 1.895735 28430 1936 total strace -c -f pnpm install 1.08s user 0.44s system 129% cpu 1.173 total ```Describe the solution you'd like
yarn to make less number of system calls while running install.
Describe the drawbacks of your solution
N/A
Describe alternatives you've considered
N/A