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(fslib): run removePromise in parallel #2582

Merged
merged 2 commits into from Mar 11, 2021
Merged

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Mar 8, 2021

What's the problem this PR addresses?

When removePromise encounters a folder it deletes its content one item at a time instead of all at once.

Ref #2575

How did you fix it?

Change the for loop to a map and Promise.all

Result

Running hyperfine -w 5 'yarn lint-staged' on https://github.com/jest-community/eslint-plugin-jest (cc @SimenB)

Benchmark #1: yarn lint-staged
-  Time (mean ± σ):      1.454 s ±  0.024 s    [User: 749.1 ms, System: 170.3 ms]
+  Time (mean ± σ):      1.458 s ±  0.041 s    [User: 732.1 ms, System: 199.7 ms]
-  Range (min … max):    1.420 s …  1.493 s    10 runs
+  Range (min … max):    1.396 s …  1.513 s    10 runs

Close to no difference in perfs but removing in parallel makes sense

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 d5bb619 into master Mar 11, 2021
@arcanis arcanis deleted the merceyz/temp-perf branch March 11, 2021 11:52
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.

None yet

2 participants