rust-analyzer: lightweight profile (disable cachePriming + cargo.auto…#1557
Open
davidcforbes wants to merge 1 commit into
Open
rust-analyzer: lightweight profile (disable cachePriming + cargo.auto…#1557davidcforbes wants to merge 1 commit into
davidcforbes wants to merge 1 commit into
Conversation
…reload) serena's symbol tools (find_symbol, find_referencing_symbols, …) only need the symbol index, but the LSP is launched with VS Code's full heavyweight defaults. On a large, actively-built Rust workspace these drove rust-analyzer to 40+ GB RSS and triggered a full re-index on every external `cargo build` (target/ churn). Disabling the two eager/auto re-indexing drivers keeps symbol navigation working at a fraction of the memory: - cachePriming.enable: True -> False (no eager whole-workspace+deps index) - cargo.autoreload: True -> False (no re-index storm on target/ changes) checkOnSave is intentionally LEFT enabled: serena's get_diagnostics_for_file relies on flycheck (`cargo check`) for Rust diagnostics, and disabling it makes that tool return empty (test/solidlsp/rust/test_rust_diagnostics.py fails with []). checkOnSave only spawns transient `cargo check` child processes and is not a driver of rust-analyzer's resident RSS, so keeping it on preserves diagnostics at no meaningful memory cost. Observed on a rustback (multi-crate + rustic_core fork) workspace: repeated 40-44 GB rust-analyzer processes under serena with no VS Code present. Suggest upstream expose a "lightweight"/symbol-only RA profile or a config toggle. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
|
Thanks, that makes sense and helps us - we noticed the slow startup on large rust projects. On ubuntu a rust diagnostics test fails, it's probably related to your change, could you look into it? |
Member
|
Seems like we just need to bump the timeout, see #1559 |
Open
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1556.
Serena launches rust-analyzer with VS Code's full heavyweight
initializationOptions, hardcoded. On a large, actively-built Rust workspace these drive rust-analyzer to 40+ GB resident and trigger a full re-index on every externalcargo build, even with no editor running. Serena's symbol tools don't need the two eager/auto re-indexing drivers:cachePriming.enable:True→False(no eager whole-workspace + all-deps index — the dominant contributor to the 40 GB resident set)cargo.autoreload:True→False(no re-index storm ontarget// Cargo metadata changes)checkOnSaveis intentionally left enabledIt is tempting to also disable
checkOnSavefor a lightweight profile, but doing so breaksget_diagnostics_for_filefor Rust: rust-analyzer's diagnostics for ordinary errors (e.g. an unresolved name →E0425) come from flycheck (cargo check), and withcheckOnSave: falseSerena's pull-diagnostics request comes back empty —test/solidlsp/rust/test_rust_diagnostics.py::test_file_diagnosticsfails with[].checkOnSaveonly spawns transientcargo checkchild processes and is not a driver of rust-analyzer's resident RSS, so keeping it on preserves diagnostics at no meaningful memory cost.Ideally these would be exposed as a config toggle (per-language
language_server_options, or a globallightweight/symbol_onlyflag) rather than hardcoded, so users who want the full RA feature set can opt in. Happy to rework toward that if preferred.Testing
uv run --extra dev pytest test/solidlsp/rust/→ 26 passed, 5 skipped on Windows 11 (Rust stable 1.95, rust-analyzer from rustup). Bisected to confirmcachePriming/autoreloadare the memory drivers andcheckOnSaveis required for the diagnostics test.