Skip to content

Commit

Permalink
perf: check if directory in .bazelignore before readdir (#1890)
Browse files Browse the repository at this point in the history
**What type of PR is this?**
Other

**What package or component does this PR mostly affect?**
all

**What does this PR do? Why is it needed?**

Now that the `.bazelignore` is done before `configure` it can also be
before the `os.ReadDir`.
  • Loading branch information
jbedard authored Aug 24, 2024
1 parent 2b326f8 commit 1a98d35
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions walk/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 1a98d35

Please sign in to comment.