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

[Case Study] Perfomance of workspaces foreach #2073

Closed
7rulnik opened this issue Nov 2, 2020 · 11 comments
Closed

[Case Study] Perfomance of workspaces foreach #2073

7rulnik opened this issue Nov 2, 2020 · 11 comments
Assignees
Labels
case study Package compatibility report upholded Real issues without formal reproduction

Comments

@7rulnik
Copy link
Contributor

7rulnik commented Nov 2, 2020

this issue not related to other projects but yarn itself

Describe the goal of the investigation

I noticed that when I'm running even very simple scripts like pwd via yarn workspaces foreach it takes a very long time. Is it expected behavior? Maybe there are some opportunities to optimize it?

Investigation report

For example, in a workspace of 100 packages, it takes almost 2min. Run via lerna takes a bit less, maybe about -15s. But I think it's still not great numbers.

@7rulnik 7rulnik added the case study Package compatibility report label Nov 2, 2020
@arcanis arcanis added the waiting for feedback Will autoclose in a while unless more data are provided label Nov 2, 2020
@yarnbot
Copy link
Collaborator

yarnbot commented Dec 2, 2020

Hi! 👋

It seems like this issue as been marked as probably resolved, or missing important information blocking its progression. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it.

@yarnbot yarnbot added the stale Issues that didn't get attention label Dec 2, 2020
@7rulnik
Copy link
Contributor Author

7rulnik commented Dec 2, 2020

Seems it's bothering only me :)

BTW in my case, it was a problem with TS and some other build tools so I just replaced tasks in packages with one in the root of the workspace.

@yarnbot yarnbot removed the stale Issues that didn't get attention label Dec 2, 2020
@christophehurpeau
Copy link
Sponsor

christophehurpeau commented Dec 3, 2020

I had the same issue (but with just a few packages), I reverted to using lerna run

@arcanis
Copy link
Member

arcanis commented Dec 3, 2020

Seems it's bothering only me :)

It's more that there isn't an identified action item, so there isn't much to say 🙂

@7rulnik
Copy link
Contributor Author

7rulnik commented Dec 3, 2020

@christophehurpeau I got kinda same performance with lerna

@yarnbot
Copy link
Collaborator

yarnbot commented Jan 2, 2021

Hi! 👋

It seems like this issue as been marked as probably resolved, or missing important information blocking its progression. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it.

@yarnbot yarnbot added the stale Issues that didn't get attention label Jan 2, 2021
@merceyz merceyz added upholded Real issues without formal reproduction and removed waiting for feedback Will autoclose in a while unless more data are provided stale Issues that didn't get attention labels Jan 2, 2021
@merceyz
Copy link
Member

merceyz commented Jan 2, 2021

I have some performance optimizations in mind that might help, i'll get a PR up eventually

@devshorts
Copy link

Yeah, I'm also in the same boat. It seems that executing even a basic echo on a single workspace item is very slow

$ yarn workspaces foreach -v -p -j 4 --include '@app/service-types' run echo-test
➤ YN0000: [@app/service-types]: echo
➤ YN0000: Done in 2s 130ms

Where all this does for the script section is "echo echo"

Running this on an entire monorepo with 20 packages takes 20-30 seconds

@devshorts
Copy link

devshorts commented Mar 9, 2021

Did some more research, seems this is not really related to foreach and more just the invocation of yarn for each workspace. I attached a debugger to the workspace tool and it itself doesn't do much. So maybe with the improvements to yarn run startup time this will get better?

@merceyz
Copy link
Member

merceyz commented Apr 17, 2021

Performance of running scripts was improved in #2564, #2576, #2577, and #2582 so it should be a lot better now, not perfect, but better. Related issues #2560 and #2575.

I'll close this as it's more related to running scripts in general which can be tracked in #2575

@merceyz merceyz closed this as completed Apr 17, 2021
@christophehurpeau
Copy link
Sponsor

I tested with latest version of yarn from sources and I can confirm it's faster ! Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
case study Package compatibility report upholded Real issues without formal reproduction
Projects
None yet
Development

No branches or pull requests

6 participants