Skip to content

Conversation

@merceyz
Copy link
Member

@merceyz merceyz commented Feb 27, 2022

What's the problem this PR addresses?

tgzUtils.convertToZip tries to get the stats of a file that never exists.

Ref #4057

How did you fix it?

Pass the default stats to the ZipFS constructor to skip the stat call.

Benchmark results

On the gatsby benchmark this removes 1918 statx calls when fetching packages

YARN_IGNORE_PATH=1 hyperfine -w 1 --prepare="rm -rf ./.yarn-global"\
  "node ./master.cjs --mode skip-build"\
  "node ./skip-zip-stat.cjs --mode skip-build"
Benchmark 1: node ./master.cjs --mode skip-build
  Time (mean ± σ):      7.906 s ±  0.201 s    [User: 51.286 s, System: 3.319 s]
  Range (min … max):    7.700 s …  8.375 s    10 runs

Benchmark 2: node ./skip-zip-stat.cjs --mode skip-build
  Time (mean ± σ):      7.847 s ±  0.191 s    [User: 51.128 s, System: 3.252 s]
  Range (min … max):    7.646 s …  8.325 s    10 runs

Summary
  'node ./skip-zip-stat.cjs --mode skip-build' ran
    1.01 ± 0.04 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 February 27, 2022 22:21
@merceyz merceyz changed the title perf(core): skip unnecessary stat call in the zip worker perf(core): skip unnecessary stat call in tgzUtils.convertToZip Feb 27, 2022
@arcanis arcanis merged commit cdad990 into master Mar 3, 2022
@arcanis arcanis deleted the merceyz/perf/worker-stat branch March 3, 2022 10:24
merceyz added a commit that referenced this pull request Oct 21, 2023
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.

3 participants