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

perf(core): skip unnecessary access call in fetchPackageFromCache #4352

Merged
merged 2 commits into from
Apr 19, 2022

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Apr 13, 2022

What's the problem this PR addresses?

During the link step of an install the Cache will check if cache entries exists on disk even though it already checked that during the fetch step.

Ref #4057

How did you fix it?

Check if the cache entry is in markedFiles before checking the disk.

Benchmark results

On the gatsby benchmark this removes 1942 access syscalls

YARN_IGNORE_PATH=1 hyperfine -w 1 \
  "node ./cache.cjs --mode skip-build" \
  "node ./master.cjs --mode skip-build"
Benchmark 1: node ./cache.cjs --mode skip-build
  Time (mean ± σ):      1.621 s ±  0.009 s    [User: 2.344 s, System: 0.352 s]
  Range (min … max):    1.605 s …  1.637 s    10 runs

Benchmark 2: node ./master.cjs --mode skip-build
  Time (mean ± σ):      1.707 s ±  0.012 s    [User: 2.397 s, System: 0.429 s]
  Range (min … max):    1.692 s …  1.725 s    10 runs

Summary
  'node ./cache.cjs --mode skip-build' ran
    1.05 ± 0.01 times faster than 'node ./master.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.

@merceyz merceyz requested a review from arcanis as a code owner April 13, 2022 11:43
@arcanis arcanis merged commit 4199c45 into master Apr 19, 2022
@arcanis arcanis deleted the merceyz/perf/cache-marked-files branch April 19, 2022 08:24
merceyz added a commit that referenced this pull request Oct 21, 2023
…#4352)

* perf(core): skip unnecessary `access` call in `fetchPackageFromCache`

* fix(core): don't add mocked packages to `markedFiles`

(cherry picked from commit 4199c45)
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