mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
fs: improve globSync performance
PR-URL: https://github.com/nodejs/node/pull/57725 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
@@ -331,10 +331,7 @@ class Glob {
|
||||
const fullpath = resolve(this.#root, path);
|
||||
|
||||
// If path is a directory, add trailing slash and test patterns again.
|
||||
// TODO(Trott): Would running #isExcluded() first and checking isDirectory() only
|
||||
// if it matches be more performant in the typical use case? #isExcluded()
|
||||
// is often ()=>false which is about as optimizable as a function gets.
|
||||
if (this.#cache.statSync(fullpath).isDirectory() && this.#isExcluded(`${fullpath}/`)) {
|
||||
if (this.#isExcluded(`${fullpath}/`) && this.#cache.statSync(fullpath).isDirectory()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user