Rust analyzer takes longer to analyze big codebase

Whenever I am working on large codebase, rust analyzer takes longer time or if not, does not finish analyzing the whole codebase in my device. I guess the issue may be due to low end pc that I possess. It has 256 GB SSD and 8GB Ram and not a good processor. Any tips on how to get LSP's initial load faster?


In the Rust Analyzer settings there's
rust-analyzer.cachePriming.enable which defaults to true. Try setting that to false and you should see a difference in startup time. That also uses less RAM (at first) which helps on a low memory system. Of course, as you dig around your codebase, the cache will eventually fill up and take more memory.

I'm also on 8GB RAM, and nvim with Rust Analyzer works great if I'm careful not to open too many editing sessions. I don't know how to have nvim sessions share a single Rust Analyzer instance. If I want a lot of Rust files open I have to use split windows within a single nvim session.


if multiple sessions are all from the same cargo workspace, you can check out ra-multiplex:

1 Like

Still loads. I opened the server logs and there are series of "server closed and restarting" logs.

Hmm.. I just tried to open a file with and without cachePriming, and now I can't see a difference in startup time or memory use. I thought it made a big difference a couple of years ago, but maybe I'm misremembering or something's changed since then.

It did make a small difference in load time when disabled CachePriming but not enough.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.