-
Notifications
You must be signed in to change notification settings - Fork 402
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
Performance of rust_analyzer #962
Comments
The issue is very likely with this here for loop: rules_rust/rust/private/rust_analyzer.bzl Line 219 in 238b998
|
Thanks for reporting! I thought about it a bit more, and I came to the conclusion that there is no easy way out here. Right now we do the depset flattening in the analysis phase of Bazel, and that seems to be dominating the profile. What we can do:
Your thoughts? |
If rust-analyzer can be made lazy then that would be the ideal approach IMO, this needs upstream changes in rust-analyzer though? I also wonder if we get more flexibility if we move into the execution phase since we might be able to have better caching during the execution, e.g. a lookup table for each crate so that we don't process them more than once. I'm not too familiar with the internals of rust-analyzer to be of much help there but I can definitely test out any changes to the rules on our repo and see if there are improvemtents. |
Yup, we will need to talk to rust-analyzer folks and see if they would be willing to let us contribute the support for Bazel. I'm happy to ask them once we have landed #907. I don't promise I will have time to contribute the code to rust-analyzer though :) You raise good points about benefits of the computation in the execution phase. Those will apply when #907 lands. I'll make sure we link any discussions related to rust analyzer support either through issues in rules_rust repo, or in Discussions in the repo. |
Could you check if #1010 made any difference in the performance? |
@hlopko This seems to have improved the performance significantly, it still takes some 10s of seconds for my repo but it's not too bad compared to how it was. Thanks for following up on this! |
The performance for the rust_analyzer rule is not that great when you have a lot of targets included in the
targets
list.The issue seems to compound if you have a deep hierarchy where there are a lot of duplicate dependencies and there are a lot of dependencies between targets.
Unfortunately I can't share a reproduction since the repository is proprietary but here is a profile of a
bazel build //:rust_analyzer
:The text was updated successfully, but these errors were encountered: