rust-analyzer: 1.85.0 - perf regression: stuck on "Roots Scanned", seems related to global cache size

OS: macOS; rustc/rust-analyzer: 1.85.0.

Took me a while to narrow it down, but it seems that it’s reproducible on a simple project:

Repro:

cargo new --bin foo
cd foo
time nvim src/main.rs  # wait till Roots Scanned and lsp is done loading, quit; may need to repeat

(sometimes lsp loading may be ok, may need to try the second and third time)

  • On 1.85.0, it takes 40-45s to load the lsp, most of the time stuck on 16/16 100% Roots Scanned
  • (!) On 1.84, the roots-scanned phase just blinks and gets skipped and it gets to indexing std/core
  • It seems to be non-deterministic, for empty projects it may take a few times to get it stuck
  • For realistic, bigger projects it always gets stuck on N/N 100% Roots Scanned

In my case, ~/.cargo may be larger than average (that’s the only suspicion, because what else can it be):

$ cd ~/.cargo
$ du -sh .
9.1G
$ fd | wc -l
  498270

Will post any further findings might there be any, but it seems like a regression.


Update: it seems that you can rebuild rust-analyzer 1.85 from source and it will fix the issue.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 17 (4 by maintainers)

Most upvoted comments

@aldanor Rust 1.85 was branched on Jan 3, while that commit is from February and #19016 was merged on Feb 24, so it’s probably not the same commit.