-
Notifications
You must be signed in to change notification settings - Fork 288
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
Format very slow when --path
not used; confusing UX for formatting multiple files
#3593
Comments
Provided some answers to the questions below, let me know if there are additional questions/concerns, thanks!
So
The
So the recommended way is that if your sources are organised in a single input (e.g. a module/workspace ideally, but the protobuf root directory, etc.), you would run a single invocation of format against the input that encapsulates all your proto sources. |
@doriable thank you for the response; I will read more about modules/workspace; This UX inquiry came about from looking into the integration of buf with https://github.com/aspect-build/rules_lint which I guess can't specify a single directory for buf as there are tons of unnecessary symlinks that might be followed. Not sure where this leaves the issue if there's any improvement to the code, documentation or neither. |
The short answer is yes. The current implementation relies on a compiled input, we are working on some improvements to formatting, but this is something that will come further down the road. I'm glad that there is a workaround, if it helps, I'll chat with the team to see if there are improvements we can make to documentation in the mean time. I am going to resolve this issue since I think the main questions are addressed, please feel free to re-open/respond if there is anything else I can help with. |
Thank you for the response on the issue even though I didn't put a reproducer GitHub repo :) |
GitHub repository with your minimal reproducible example (do not leave this field blank or fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)
Please let me know if it's needed and I can provide one; right now I'm trying to understand the UX of
--path
vs. providing positional argument<source>
and the discrepancy on time.Commands
buf seems to take ~1-3s to startup and process 1 file.
Consequently, if you run it on the whole directory (including bazel-out symlinks which has all the external protocol files)... it also takes ~3s total
We are using an implementation of a linter that iterates over each file since having looked at the
--help
buf seems to have only accepted a single<source>
.For us since it's running over each protobuf; it takes >1minute to format all the files (3s * N)
I did notice however that using
--path
seems to be a way to provide multiple sources; interestingly running format with--path
is also way way faster.Here is a comparison of the two to show the delta (0.025s vs 1s):
I guess my questions are:
--path
run way faster?--path
vs. the<source>
positional argument?The text was updated successfully, but these errors were encountered: