Skip to content

Commit

Permalink
perf(fslib): run removePromise in parallel (#2582)
Browse files Browse the repository at this point in the history
* perf(fslib): run removePromise in parallel

* Update FakeFS.ts

Co-authored-by: Maël Nison <nison.mael@gmail.com>
  • Loading branch information
merceyz and arcanis committed Mar 11, 2021
1 parent d24eeb8 commit d5bb619
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .yarn/versions/6e4ec8bf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/fslib": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-file"
- "@yarnpkg/plugin-git"
- "@yarnpkg/plugin-github"
- "@yarnpkg/plugin-http"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-link"
- "@yarnpkg/plugin-node-modules"
- "@yarnpkg/plugin-npm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- vscode-zipfs
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
- "@yarnpkg/json-proxy"
- "@yarnpkg/pnp"
- "@yarnpkg/pnpify"
- "@yarnpkg/shell"
10 changes: 7 additions & 3 deletions packages/yarnpkg-fslib/sources/FakeFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,13 @@ export abstract class FakeFS<P extends Path> {
}

if (stat.isDirectory()) {
if (recursive)
for (const entry of await this.readdirPromise(p))
await this.removePromise(this.pathUtils.resolve(p, entry));
if (recursive) {
const entries = await this.readdirPromise(p);

await Promise.all(entries.map(entry => {
return this.removePromise(this.pathUtils.resolve(p, entry));
}));
}

// 5 gives 1s worth of retries at worst
let t = 0;
Expand Down

0 comments on commit d5bb619

Please sign in to comment.