-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize Gazelle's filesystem traversal #1820
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
53e3725
to
1bfec6f
Compare
@linzhp please take a look? |
782fe50
to
ccd0e08
Compare
Why not simply use filepath.WalkDir instead? Doesn't need a new dependency and achieves the same goal of being more efficient by not calling |
Because it doesn't parallelize the walk. This is faster See also #1737 |
I understand that, though I imagine a lot of the time savings will be from not calling |
I don't have exact numbers offhand anymore; we wrote these patches months ago. FWIW We do run gazelle as part of pre-commit hook so we are fairly perf-sensitive on this. I recognize that perhaps performance is not a primary motivation for the project; feel free to close out the PR if you aren't interested. (BTW are you sure the os.Lstat is still an issue? I believe os.Readdir is already avoiding it since Go 1.16, perhaps you were thinking of ioutil.Readdir? I did measure some speedups when I contributed https://github.com/bazelbuild/bazel-gazelle/pull/1704/files) |
I agreed with @uhthomas that we should avoid another external library before comparing it with filepath.WalkDir. |
What type of PR is this?
Performance
What package or component does this PR mostly affect?
All
What does this PR do? Why is it needed?
This PR improves Gazelle's filesystem walk in 2 ways:
Which issues(s) does this PR fix?
Fixes #1819
Other notes for review