From be967b94e15f238a6fe806e93359e302c43d0e45 Mon Sep 17 00:00:00 2001 From: Michal Terepeta Date: Mon, 6 Jan 2020 22:06:01 +0100 Subject: 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 --- crates/ra_ide/src/change.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ra_ide/src/change.rs b/crates/ra_ide/src/change.rs index f92950b71..8b197d642 100644 --- a/crates/ra_ide/src/change.rs +++ b/crates/ra_ide/src/change.rs @@ -201,7 +201,7 @@ impl RootDatabase { libraries.push(library.root_id); self.set_source_root_with_durability( library.root_id, - Default::default(), + Arc::new(SourceRoot::new_library()), Durability::HIGH, ); self.set_library_symbols_with_durability( -- cgit v1.2.3