Rust analyzer: any tips to increase its performance?

Hi,

I have a crate that is getting big, with some dependencies using a lot of macros.
The culprits are here.

Linus Debian
VSCode
RA plugin

Everything up to date, with nightly toolchain.

I have to restart the rust analyzer server multiple times a day because it becomes unresponsive.

My machine has a lot of spare ram (32GB) and a processor that is still OK (i7 8750H).

I tried to increase the LRU capacity to 8192, even tried 16384 (that should be huge enough).
The effect is minimal.

So is there any (un)known tip that increase its perf? I don't care if it's a memory hog. I just want it to be faster/ more reactive and stop restarting RA every 5 minutes because errors are kept active when they are solved already.

Any tips welcomed,

Thanks guys

Do you have "rust-analyzer.check.command": "clippy" by any chance? That will consumer an order of magnitude more resources than just cargo-check.

Yes I do, I will try without but I really like it.
Any chance that it avoids to parse macros ?

Can you split your big crate into smaller crates? If it's big there must be parts of it that are quite stable and that you could put into other smaller crates

I actually already split it into 5 crates. And the one that is the most demanding is difficult to split more unfortunately..

1 Like

Is there an easy way to toggle the check command so that I can use cargo check most of the time for quick error checking and then use clippy to clean up the code once it compiles.

1 Like

A temporary fix, is to have multiple VSCode windows that target different crates.

That way, RA doesn't try to sync a whole code base.

You end up with many windows opened; but it is what it is I guess..

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.