Skip to content
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

internal: port rust-analyzer to new Salsa #18964

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

davidbarsky
Copy link
Contributor

This PR ports rust-analyzer to the new Salsa. It is big, partially incomplete, and best reviewed commit-by-commit. I will be rebasing often.

(Why new Salsa? It unblocks a lot of work described in #17491.)

Migration Approach

To get rust-analyzer compiling and passing tests, this PR did the following:

With these changes, all tests were passing (no correctness issues!), analysis-stats produced the same results as rust-analyzer on the old Salsa, and—critically—the new Salsa-powered rust-analyzer was usable as my daily driver. Unfortunately, memory usage was too high. I'm really grateful to the following folks who helped fix that regression:

Performance

  • On rust-analyzer analysis-stats, new Salsa is slightly slower and uses slightly more memory.
    • On bfb8127, new Salsa uses 2201mb of memory, whereas old Salsa uses ~2000 megabytes.
  • On crates/rust-analyzer/src/integrated_benchmarks.rs, new Salsa is slightly faster on both cold and warm updates. These benchmarks should probably be more rigorous, but new Salsa was consistently faster.

Things to Fix Before to Merging

There's a few things to do before this change is merged:

  1. Reintroduce debug item printing. However, this is blocked on feature: Add support for dumping database contents salsa-rs/salsa#640 and some additional changes inside of rust-analyzer, but they're not complicated changes.
  2. Figure out why the changes in the enum/#[salsa::supertype] commit cause tests to fail to type confusion in the underlying Salsa pages. Chayim is working on root-causing this, but if he's unable to determine the cause, I can make the enum changes a separate pull request.
  3. Release db-ext-macro.
    1. I'd like to rename db-ext-macro to something else, or have it live in Salsa. I'm unsure which option I'd prefer right now.
  4. Release the new Salsa to crates.io.

Acknowledgements

This wouldn't have been possible without the assistance of many folks including @ChayimFriedman2, @ShoyuVanilla, @nikomatsakis, and @Veykril. I'm sure I'm forgetting some people, to whom I apologize.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants