-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
When running a yarn install with my sample repository (https://github.com/blimmer/yarn-bug-reports/tree/output-buffering), I experience three very different timings to complete a yarn install on the same repository.
It appears that this has something to do with how quickly my terminal can display the scrolling output coming from the yarn invocation.
To reproduce
I'm sorry, but I wasn't able to get this working in Sherlock. However, it should be pretty simple to pull down my test repository to see this behavior.
git clone -b output-buffering https://github.com/blimmer/yarn-bug-reports.gitcd yarn-bug-reports
Now we will go through three distinct scenarios, using time to calculate the time each process takes to complete the same command.
With Terminal Focused
In the terminal, run time yarn install. Leave the terminal focused. You'll notice a lot of warnings (e.g., ➤ YN0013: │ jest-runtime@npm:27.5.1 can't be found in the cache and will be fetched from the remote regis) scrolling by since it's the first time running yarn install in this repo.
For me, this takes 2 minutes 15 seconds yarn install 102.45s user 9.16s system 82% cpu 2:15.24 total.
Logs
~/code/yarn-bug-reports output-buffering time yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2 [9a4a3] doesn't provide typescript (pe9669), requested by ts-node
➤ YN0002: │ @endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2 [c6211] doesn't provide typescript (pc78ba), requested by ts-node
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide @aws-cdk/aws-logs (p0d64c), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide @aws-cdk/aws-logs-destinations (p52934), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide constructs (pdcaf4), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide jest (pf1db5), requested by @aws-cdk/assert
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide prettier (pb5d06), requested by eslint-plugin-prettier
➤ YN0002: │ yarn-repro@workspace:. doesn't provide graphql-tag (p503cc), requested by @graphql-codegen/typescript-react-apollo
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yargs@npm:16.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:17.3.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yn@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registr
➤ YN0013: │ zip-stream@npm:4.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 2m 10s
➤ YN0000: ┌ Link step
➤ YN0007: │ esbuild@npm:0.14.23 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.12.29 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 4s 929ms
➤ YN0000: Done with warnings in 2m 15s
yarn install 102.45s user 9.16s system 82% cpu 2:15.24 total
IMPORTANT: reset state between tests by running:
git clean -fdx && yarn cache clean --all
With Terminal Unfocused
I just happened to notice that when another ITerm window is focused, the logs scroll by much more quickly.
First, split your pane horizontally by right-clicking and choosing "Split Pane Horizontally". Then, run time yarn install in one pane, and immediately click into the new blank pane you opened. You'll notice that the log output scrolls much more quickly when the window that time yarn install is running in is not actively selected.
This video shows what I'm experiencing on my machine: https://www.youtube.com/watch?v=xCfglVxuD7g.
This takes way less time to run yarn install than the previous test case, 55 seconds (yarn install 102.96s user 9.30s system 201% cpu 55.686 total).
Logs
~/code/yarn-bug-reports output-buffering time yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2 [9a4a3] doesn't provide typescript (pe9669), requested by ts-node
➤ YN0002: │ @endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2 [c6211] doesn't provide typescript (pc78ba), requested by ts-node
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide @aws-cdk/aws-logs (p0d64c), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide @aws-cdk/aws-logs-destinations (p52934), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide constructs (pdcaf4), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide jest (pf1db5), requested by @aws-cdk/assert
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide prettier (pb5d06), requested by eslint-plugin-prettier
➤ YN0002: │ yarn-repro@workspace:. doesn't provide graphql-tag (p503cc), requested by @graphql-codegen/typescript-react-apollo
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yargs@npm:16.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:17.3.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yn@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registr
➤ YN0013: │ zip-stream@npm:4.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 49s 836ms
➤ YN0000: ┌ Link step
➤ YN0007: │ esbuild@npm:0.14.23 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.12.29 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 5s 10ms
➤ YN0000: Done with warnings in 55s 189ms
yarn install 102.96s user 9.30s system 201% cpu 55.686 total
IMPORTANT: reset state between tests by running:
git clean -fdx && yarn cache clean --all
With the CI variable set
I can recreate a similar install time to the "With Terminal Unfocused
" test by setting the CI environment variable, which also appears to disable the scrolling output.
This takes 53 seconds yarn install 101.41s user 8.71s system 206% cpu 53.305 total.
Logs
~/code/yarn-bug-reports output-buffering export CI=true
~/code/yarn-bug-reports output-buffering time yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2 [9a4a3] doesn't provide typescript (pe9669), requested by ts-node
➤ YN0002: │ @endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2 [c6211] doesn't provide typescript (pc78ba), requested by ts-node
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide @aws-cdk/aws-logs (p0d64c), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide @aws-cdk/aws-logs-destinations (p52934), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide constructs (pdcaf4), requested by datadog-cdk-constructs
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide jest (pf1db5), requested by @aws-cdk/assert
➤ YN0002: │ infrastructure@workspace:infrastructure doesn't provide prettier (pb5d06), requested by eslint-plugin-prettier
➤ YN0002: │ yarn-repro@workspace:. doesn't provide graphql-tag (p503cc), requested by @graphql-codegen/typescript-react-apollo
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 22 packages were already cached, 1163 had to be fetched
➤ YN0000: └ Completed in 47s 888ms
➤ YN0000: ┌ Link step
➤ YN0007: │ esbuild@npm:0.14.23 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.12.29 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 4s 578ms
➤ YN0000: Done with warnings in 52s 808ms
yarn install 101.41s user 8.71s system 206% cpu 53.305 total
Environment
System:
OS: macOS 12.2.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.14.0 - /private/var/folders/tx/kg437xgx1yv5yx3m0mtm0d8h0000gn/T/xfs-ef13bc38/node
Yarn: 3.2.0 - /private/var/folders/tx/kg437xgx1yv5yx3m0mtm0d8h0000gn/T/xfs-ef13bc38/yarn
npm: 8.3.1 - ~/.asdf/plugins/nodejs/shims/npm
npmPackages:
jest: 27 => 27.5.1Additional context
No response