Is there a recommended way to determine what might be causing rust-analyzer slowness?
I've recently updated Rust for my project to 1.85.1 and am experiencing incredibly slow startup with default configurations. Just running rust-analyzer diagnostics crates/foo/lib.rs
is taking a full minute on a crate with fewer than 10 files. I first noticed the slowness when my Neovim completions/diagnostics/etc. took minutes to be available after a cold editor start (I've generally been using pretty stock configuration via rustaceanvim and previously this took <2s).
Things are much faster (though still slower than they used to be) if I use a rust-project.json
generated via bazel run @rules_rust//tools/rust_analyzer:gen_rust_project
. That "solution", however, brings with it some rust-analyzer instability that I'd like to avoid. My project builds with both cargo and bazel toolchains.
If this is something weird with my configuration, great! I'd love to just fix my situation... but I don't know how to go about ruling out rust-analyzer being the issue.
I've combed through this forum, Zulip, GitHub issues, etc. and can't really find any consistent recommendations beyond "try changing this config value!" or "update!". I'm up to date AFAICT (Rust 1.85.1 toolchain, including rust-analyzer) and want something more consistent than "flip these twelve bits through the search space of 2^12 until something works or you go insane". If you do have pointers to things I've overlooked, please share them! It's always possible I didn't find the appropriate needle.
As always, let me know if there's a better place for this discussion. I got here via a pointer from GitHub - rust-lang/rust-analyzer: A Rust compiler front-end for IDEs .
Thank you!