Content-Length: 266834 | pFad | https://redirect.github.com/nodejs/node/commit/8f643471ef

79 fs: improve globSync performance · nodejs/node@8f64347 · GitHub
Skip to content

Commit 8f64347

Browse files
Trottaduh95
authored andcommitted
fs: improve globSync performance
PR-URL: #57725 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent f3a4d03 commit 8f64347

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/internal/fs/glob.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,7 @@ class Glob {
331331
const fullpath = resolve(this.#root, path);
332332

333333
// If path is a directory, add trailing slash and test patterns again.
334-
// TODO(Trott): Would running #isExcluded() first and checking isDirectory() only
335-
// if it matches be more performant in the typical use case? #isExcluded()
336-
// is often ()=>false which is about as optimizable as a function gets.
337-
if (this.#cache.statSync(fullpath).isDirectory() && this.#isExcluded(`${fullpath}/`)) {
334+
if (this.#isExcluded(`${fullpath}/`) && this.#cache.statSync(fullpath).isDirectory()) {
338335
return;
339336
}
340337

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://redirect.github.com/nodejs/node/commit/8f643471ef

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy