Skip to content

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Apr 3, 2023

What's the problem this PR addresses?

Yarn persists workspaces one at a time which with 1000s of workspaces noticeably slows down an install.

How did you fix it?

Persist the workspaces in parallel.

Results

Tested on the DefinitelyTyped repo with its 8629 workspaces (matching only types/*):

$ YARN_IGNORE_PATH=1 hyperfine -w 1 "node ./after-plimit.cjs --mode skip-build" "node ./after.cjs --mode skip-build" "node ./before.cjs --mode skip-build"
Benchmark 1: node ./after-plimit.cjs --mode skip-build
  Time (mean ± σ):     16.106 s ±  0.605 s    [User: 13.252 s, System: 9.803 s]
  Range (min … max):   15.090 s … 17.147 s    10 runs

Benchmark 2: node ./after.cjs --mode skip-build
  Time (mean ± σ):     16.644 s ±  0.635 s    [User: 13.874 s, System: 10.015 s]
  Range (min … max):   15.932 s … 18.146 s    10 runs

Benchmark 3: node ./before.cjs --mode skip-build
  Time (mean ± σ):     17.390 s ±  0.641 s    [User: 13.684 s, System: 10.219 s]
  Range (min … max):   16.582 s … 19.000 s    10 runs

Summary
  'node ./after-plimit.cjs --mode skip-build' ran
    1.03 ± 0.06 times faster than 'node ./after.cjs --mode skip-build'
    1.08 ± 0.06 times faster than 'node ./before.cjs --mode skip-build'

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis merged commit 03995ff into master Apr 24, 2023
@arcanis arcanis deleted the merceyz/perf/persist-parallel branch April 24, 2023 16:02
merceyz added a commit that referenced this pull request Apr 24, 2023
* perf(core): persist workspaces in parallel

* Update packages/yarnpkg-core/sources/Project.ts

Co-authored-by: Maël Nison <[email protected]>

---------

Co-authored-by: Maël Nison <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants