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

Parallelizes package unplugging #3955

Merged
merged 3 commits into from
Jan 7, 2022
Merged

Parallelizes package unplugging #3955

merged 3 commits into from
Jan 7, 2022

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Jan 7, 2022

What's the problem this PR addresses?

Packages are currently unplugged one by one. Now that we have a proper API to start processing such things in the background while we use the CPU for other things, we should use it.

How did you fix it?

Wrap unplugs into api.holdFetchResult.

Checklist

  • 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.

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
@merceyz
Copy link
Member

merceyz commented Jan 7, 2022

Here are some benchmark results

Gatsby benchmark

$ YARN_IGNORE_PATH=1 hyperfine -w 1 --prepare="rm -rf .yarn/unplugged"\
                                                    "node ./master.cjs --mode skip-build"\
                                                    "node ./parallel-unplug.cjs --mode skip-build"
Benchmark 1: node ./master.cjs --mode skip-build
  Time (mean ± σ):      4.799 s ±  0.040 s    [User: 5.243 s, System: 2.759 s]
  Range (min … max):    4.749 s …  4.885 s    10 runs

Benchmark 2: node ./parallel-unplug.cjs --mode skip-build
  Time (mean ± σ):      3.950 s ±  0.059 s    [User: 4.884 s, System: 2.409 s]
  Range (min … max):    3.861 s …  4.057 s    10 runs

Summary
  'node ./parallel-unplug.cjs --mode skip-build' ran
    1.21 ± 0.02 times faster than 'node ./master.cjs --mode skip-build'

next.js repo with all examples included

$ YARN_IGNORE_PATH=1 hyperfine -w 1 --prepare="rm -rf .yarn/unplugged"\
                                                "node ./master.cjs --mode skip-build"\
                                                "node ./parallel-unplug.cjs --mode skip-build"
Benchmark 1: node ./master.cjs --mode skip-build
  Time (mean ± σ):     36.776 s ±  0.980 s    [User: 37.445 s, System: 19.966 s]
  Range (min … max):   36.015 s … 39.315 s    10 runs

Benchmark 2: node ./parallel-unplug.cjs --mode skip-build
  Time (mean ± σ):     29.289 s ±  0.137 s    [User: 34.178 s, System: 17.034 s]
  Range (min … max):   29.044 s … 29.426 s    10 runs

Summary
  'node ./parallel-unplug.cjs --mode skip-build' ran
    1.26 ± 0.03 times faster than 'node ./master.cjs --mode skip-build'

@arcanis arcanis merged commit a248d0b into master Jan 7, 2022
@arcanis arcanis deleted the mael/parallel-unplug branch January 7, 2022 22:12
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