You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using `os.walk` instead of `Path().rglob` can be 10x faster in deeply
nested directory structures. This is a significant saving on certain
projects, where just this iteration can take up to 3 or 4 seconds.
An even better approach would be to parse gitignore files lazily, as the
directory tree is traversed later in this function. Another optimization
would be to prune ignored directories while walking the directory tree,
so they aren't even explored.
However, just the single optimization in this PR already reduces the
impact of this code significantly, bringing it from almost 3s in my
profile to just 0.4s.
0 commit comments