rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.3k stars 1.61k forks source link

Indexing is too slow comparing to Clion #8810

Closed GopherJ closed 2 years ago

GopherJ commented 3 years ago
image

after upgrading to latest rust-analyzer, the indexing becomes extremly slow. I have been waiting for more than 10mins on my macbook pro m1

The test code: https://github.com/parallel-finance/parallel

GopherJ commented 3 years ago

I'm using RA@2021-05-10 and latest coc.nvim & latest coc-rust-analyzer, my configuration is at: https://github.com/GopherJ/cfg/blob/master/coc/.vimrc

GopherJ commented 3 years ago

This is maybe a pb of substrate(https://github.com/paritytech/substrate), but is there a way to speedup indexing? as I always feel it's too slow, also we didn't have a cache like jetbrains

which makes things crazy:)

GopherJ commented 3 years ago

It's maybe related to https://github.com/paritytech/polkadot/issues/2919

GopherJ commented 3 years ago

yesterday's test:

indexing is too slow and no cache persisted, currently if I open https://github.com/parallel-finance/parallel/blob/master/pallets/liquid-staking/src/lib.rs it took 3mins 1sec to finish indexing on a i9-10900k, 32GB PC

image

Veykril commented 2 years ago

We minimzed what we prime in projects a bunch recently, can you check if things have gotten better here?

lnicola commented 2 years ago

We seem to spend about 20-30 seconds loading this project, which seems reasonable given the huge amount of code involved. The initial load is slower because a check build takes about 5 minutes.

mathiaspeters commented 2 years ago

I've also noticed in recent versions that indexing is slow, for me specifically with async-std. All other crates index in a second or two but async-std takes well over a minute

lnicola commented 2 years ago

@mathiaspeters are you using async-std 1.11.0?

mathiaspeters commented 2 years ago

async-std 1.10.0

lnicola commented 2 years ago

Try updating. They made some huge improvements in compile time in the latest version. async-std 1.10 is specifically tracked on our side in https://github.com/rust-analyzer/rust-analyzer/issues/11363.

Besides that, you can now also use "rust-analyzer.cache.warmup": false to disable that "indexing" step, or you can disable build scripts, proc macros and/or check on save. Since we seem to be faster these days at loading that project, we don't know what or if is still slow, and there are some workarounds, I think we can close this for now.