Skip to content

Commit be967b9

Browse files
committed
Fix a problem with Durability of libraries
When processing a change with added libraries, we used `Default::default` for `SourceRoot` which sets `is_library` to false. Since we use `is_library` to decide whether to use low or high durability, I believe that this caused us to mark many library dependencies as having low durability and thus increased the size of the graph that salsa needed to verify on every change. Based on my initial tests this speeds up the `CrateDefMapQuery` on rust-analyzer from about ~64ms to ~14ms and reduces the number of validations for the query from over 60k to about 7k. Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
1 parent 07340a6 commit be967b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/ra_ide/src/change.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl RootDatabase {
201201
libraries.push(library.root_id);
202202
self.set_source_root_with_durability(
203203
library.root_id,
204-
Default::default(),
204+
Arc::new(SourceRoot::new_library()),
205205
Durability::HIGH,
206206
);
207207
self.set_library_symbols_with_durability(

0 commit comments

Comments
 (0)