-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
rust analyzer take too long to lunch #14258
Comments
Rust analyzer needs to analyze everything from scratch every time you launch it. See also #4712 You might want to try https://github.com/pr2502/ra-multiplex to allow reusing the same rust analyzer instance when closing and re-opening (n)vim. |
Are you saying it's taking longer than the previous version? |
Do you have a hhd if yes, I will advice you to try to check it again and if the problem is still there. Then providing your config would be great |
Setting |
yes
yes |
no I'm using nvme storage device and its fast |
found this report because I have to wait around ten minutes for the rust-analyzer to be ready every time I continue working on a project. I work on a small, portable laptop that's usually turned off and my project files are on external drives that don't stay connected to it, especially if I carry it around. Is ten minutes reasonable? I understand that my 4 core intel atom x5-Z8350 CPU @ 1.44GHz with 4GB RAM is not a gaming rig, but I thought it was sufficient for coding... maybe I'm wrong. Is rust-analyzer designed for fast computers or might something else be the culprit here? |
@s-mayrh that's a very slow CPU of around 2 W TDP. Everything is going to be slow there, including cargo or a Web browser. That said, how exactly are you measuring, and what OS are you running? |
@lnicola I have only just noticed that these waiting times, which are already measurable in this order of magnitude with a glance at the clock, are unusual. it's a windows 10 tablet/laptop hybrid (lenovo miix 310-10ICR). in everyday life - when i'm not compiling rust code - i still have firefox with 30 open tabs, thunderbird, libreoffice and 2 instances of signal open at the same time, but haven't noticed any noticeable delays or other slowdowns so far. my other - the linux "desktop computer" - is a raspberry 4 with 8 gb ram on 2 ghz, which is a bit faster, but now that i read that for other people 30 seconds wait time is already long, i wonder if i have grossly overestimated my expectations, after all 1.4 ghz and 4 gb ram didn't seem inconclusive to me for "conventional" programming tasks and i've been more focused on power consumption so far. i didn't seem to notice that the cpu requirements for programming tasks have increased so much compared to the past - or that atom and arm cpu are a no-no for rust. if that's the case, it will probably make sense to get a normal headless pc at home that runs on demand to run rust-analyzer, as well as the compiler there dedicated. does that make sense or how would you do it? |
How do you know it finished loading? And is it using bevy? I noticed the issue where you were saying it takes one hour to build, which seems about right on that CPU (I imagine Unreal Engine will take about the same). |
@lnicola vscode displays an animated throbber next to 'rust-analyzer' in its status bar and indeed i'm practicing a bevy tutorial project which in it's current state is equal to this code here: https://github.com/frederickjjoubert/bevy-ball-game/tree/Episode-7 cold compile of bevy takes even two hours. i only started to question my laptop's performance when adding 'rand' to my project caused this ominous one hour of compile time. i'm curious how other digital nomads are doing this? because i also consider renting a virtual server for such cpu heavy stuff now 🤔 |
You can disable cache priming in the settings. The status bar might say "indexing", but RA is fully working by that time. Bevy is pretty large, probably comparable to Unreal Engine. And you might be hitting swap too, I don't know. I suspect most people who travel like that will have an Ultrabook-class device, or a MacBook. These are an order of magnitude faster than your 4 W CPU. I've recently had the opportunity to use my laptop at 0.875 W, it was a memorable experience, and not in a good way. |
Ping @s-mayrh did you try disabling |
@lnicola i just disabled this via vscode settings and restarted. this is what I saw the first 8 minutes:
after that the throbber is gone, but it took another two minutes until tooltip and autocomplete were working. until then i just had memory usage was almost constant [edit] during [/edit] this process 3.0/4.0 GB with a constant 228 MB swapped out. There was no swapping, just 100% cpu time |
I too have this issue. Have been using VSCode with various languages and plugins, never any issues. But the rust-analyzer takes at least 5 minutes to load... |
@hapiel what exactly are you seeing, and are you working on some blockchain codebase? |
I'm not working on blockchain stuff. The only crate I've installed is whiskers and its dependencies. |
If it's https://github.com/hapiel/genuary24_rust/blob/master/day05_vera_molnar/Cargo.toml, then you have about 800 crates in your dependency tree. A rust-analyzer runs the builds scripts when loading the project, which means building at least part of that (they're reported in the status bar). On my computer (with Most of that time seems to be spent in proc macro expansion (or the syntax bridge). TL;DR, your project is not small at all, but if RA is significantly slow when opening it a second time, it might be worth looking into. |
I see, the project is indeed pretty big then. Indeed that was the project I was working on. Running on a i5-8250u, 1.6Ghz, 4 core, not fast but usually not slow either. |
That's a 15 W TDP CPU compared to my 105 W one, it's not going to be as fast. You can speed it up a little by disabling |
I might be biased because I've got 5950X as well but I also have 2-in-1 HP with 8250u. |
@mati865 wait until you see my 0.875 W PL1 1260P :-). |
rust-analyzer take to much time to lunch like 30s
hi there,
I"m using neovim, and i installed rust-analyzer with aur(arch user repo (AUR :: like store but for arch-artix linux),
and i install rust analyzer with mason and nvim lsp
it takes way to long to lunch the last version was fast to lunch this is a new problem with me
this is my laptop specks
CPU: Intel i5-7300U (4) @ 3.500GHz
GPU: Intel HD Graphics 620
Memory: 7689MiB
neovim version is 0.8.3
rust-analyzer version is :
rust-analyzer 0.0.0 (0a956ec 2023-03-05)
The text was updated successfully, but these errors were encountered: