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

Faster yarn run command #1829

Closed
1 of 2 tasks
remorses opened this issue Sep 10, 2020 · 1 comment
Closed
1 of 2 tasks

Faster yarn run command #1829

remorses opened this issue Sep 10, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@remorses
Copy link

  • I'd be willing to implement this feature
  • This feature can already be implemented through a plugin

Describe the user story

yarn run commands take about 2-3 seconds on a workspace with 250 packages

yarn workspaces foreach --parallel exec echo hello takes 2 minutes to run with 100% cpu usage

Describe the solution you'd like

The functions that take most of the time are setupResolutions and setupWorkspaces, we should make those functions time complexity constant, storing the needed data structures in the cache and updating those only on install

Describe the drawbacks of your solution

Describe alternatives you've considered

An alternative to using a cache for needed data structures is making the algorithms faster, this isn't a real solution, you can't make a full tree traversal in constant time

Additional context

@remorses remorses added the enhancement New feature or request label Sep 10, 2020
@arcanis
Copy link
Member

arcanis commented Sep 10, 2020

While there's likely room to improve things, I'll close this issue as there isn't a definite action item and it'd likely remain open forever. I'd suggest to read the relevant parts of the code (and ask questions on Discord if any), and directly open a PR to improve the code incrementally.

Note that caches have their own costs (they need to be kept in sync, they add complexity in the code) that may make them a not-so-great option. Not everything has to belong to the core, and perhaps if you have high-perf requirements on 250 workspaces it's worth considering implementing your own commands that do less things than us, but in a more efficient way.

@arcanis arcanis closed this as completed Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants