Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: big delay on a script (or command) execution #6622

Closed
1 task
Wroud opened this issue Nov 30, 2024 · 2 comments
Closed
1 task

[Bug?]: big delay on a script (or command) execution #6622

Wroud opened this issue Nov 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Wroud
Copy link

Wroud commented Nov 30, 2024

Self-service

  • I'd be willing to implement a fix

Describe the bug

Yarn delay for scripts is too big comparing to npm

macos:

wroud@wroud client % time yarn echo
ok
yarn echo  0.28s user 0.05s system 120% cpu 0.266 total
wroud@wroud client % time yarn echo
ok
yarn echo  0.28s user 0.04s system 130% cpu 0.243 total
wroud@wroud client % time npm run echo

> echo
> echo 'ok'

ok
npm run echo  0.09s user 0.03s system 83% cpu 0.141 total
wroud@wroud client % 

windows (powershell):

PS D:\work\personal\foundation> Measure-Command { yarn echo }


Milliseconds      : 434
TotalMilliseconds : 434.9869



PS D:\work\personal\foundation> Measure-Command { npm run echo }


Milliseconds      : 285
TotalMilliseconds : 285.7122

nesting:

"scripts": {
    "echo": "echo 'ok'",
    "echo2": "yarn echo",
}
wroud@wroud client % time yarn echo2
ok
yarn echo2  0.78s user 0.11s system 84% cpu 1.058 total

this is actual for any composite script like 'tsc -b && yarn bundle'

comparing to npm:

  "scripts": {
    "echo": "echo 'ok'",
    "echo2": "npm run echo",
  }
wroud@wroud client % time npm run echo2

> echo2
> npm run echo


> echo
> echo 'ok'

ok
npm run echo2  0.18s user 0.05s system 91% cpu 0.249 total

To reproduce

I use monorepo with pnp (but switching to node_modules have no effect)

script is "echo": "echo 'ok'",

Delay is really noticible. It also affects all comands not only scripts.
It's critical when runned in ci/cd or with combination 'yarn workspaces foreach`

here is an example: https://github.com/Wroud/foundation/actions/runs/12098355117/job/33734738575
you can see that "Release" and "Tag" steps took almost the same time

[@wroud/preconditions]: Process started
[@wroud/preconditions]: Tag already exists:  preconditions-v0.2.1
[@wroud/preconditions]: Time: 34
[@wroud/preconditions]: Process exited (exit code 0), completed in 1s 367ms

here you can see that script itself executed in 34ms when total time is 1367ms

when directly executed:

wroud@wroud di % time yarn ci git-tag --prefix di-v
Tag already exists:  di-v0.15.1
Time: 36
yarn ci git-tag --prefix di-v  0.88s user 0.12s system 128% cpu 0.771 total

Environment

System:
    OS: macOS 15.1
    CPU: (12) arm64 Apple M2 Pro
  Binaries:
    Node: 22.11.0 - /private/var/folders/hr/z2pjf65s3yj3nlwq3zxff1n00000gn/T/xfs-1edaafc0/node
    Yarn: 4.5.3 - /private/var/folders/hr/z2pjf65s3yj3nlwq3zxff1n00000gn/T/xfs-1edaafc0/yarn
    npm: 10.9.0 - /usr/local/bin/npm
    pnpm: 8.11.0 - ~/Library/pnpm/pnpm

Additional context

No response

@Wroud Wroud added the bug Something isn't working label Nov 30, 2024
@Wroud
Copy link
Author

Wroud commented Dec 2, 2024

Image
also, yarn command take twice more actual time (delay + execution time)

@arcanis
Copy link
Member

arcanis commented Dec 2, 2024

Duplicate with #2575; also see: #6608 (comment)

@arcanis arcanis closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants