From b0dbb5c5a1087edb0c95d252d735da1be25abf65 Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Sat, 24 Aug 2024 01:32:11 -0700 Subject: [PATCH] perf: check if directory in .bazelignore before readdir --- walk/walk.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/walk/walk.go b/walk/walk.go index 6a3778008..cfc088c98 100644 --- a/walk/walk.go +++ b/walk/walk.go @@ -126,6 +126,10 @@ func Walk(c *config.Config, cexts []config.Configurer, dirs []string, mode Mode, } func visit(c *config.Config, cexts []config.Configurer, isBazelIgnored isIgnoredFunc, knownDirectives map[string]bool, updateRels *UpdateFilter, wf WalkFunc, dir, rel string, updateParent bool) { + if isBazelIgnored(rel) { + return + } + haveError := false // TODO: OPT: ReadDir stats all the files, which is slow. We just care about @@ -148,10 +152,6 @@ func visit(c *config.Config, cexts []config.Configurer, isBazelIgnored isIgnored haveError = true } - if isBazelIgnored(rel) { - return - } - c = configure(cexts, knownDirectives, c, rel, f) wc := getWalkConfig(c)