aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-06-07 07:50:32 +0100
committerAleksey Kladov <[email protected]>2019-06-12 11:25:30 +0100
commitfc2658b0749b03f365a3f176582311efd2bc6462 (patch)
treed58e53fdcea6d4de6c37a7e1bc3b762db77754bd /crates
parent80aa9d5f9f55341d2a51176e385d8aa6d2d2cec8 (diff)
use salsa's LRU for syntax trees
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_batch/src/lib.rs4
-rw-r--r--crates/ra_db/Cargo.toml2
-rw-r--r--crates/ra_ide_api/src/change.rs1
-rw-r--r--crates/ra_ide_api/src/db.rs4
4 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index a445dcb4d..02ea89306 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -7,7 +7,7 @@ use std::collections::HashSet;
7use rustc_hash::FxHashMap; 7use rustc_hash::FxHashMap;
8 8
9use ra_db::{ 9use ra_db::{
10 CrateGraph, FileId, SourceRoot, SourceRootId, SourceDatabase, salsa, 10 CrateGraph, FileId, SourceRoot, SourceRootId, SourceDatabase, salsa::{self, Database},
11}; 11};
12use ra_hir::db; 12use ra_hir::db;
13use ra_project_model::ProjectWorkspace; 13use ra_project_model::ProjectWorkspace;
@@ -43,6 +43,8 @@ fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId {
43impl BatchDatabase { 43impl BatchDatabase {
44 pub fn load(crate_graph: CrateGraph, vfs: &mut Vfs) -> BatchDatabase { 44 pub fn load(crate_graph: CrateGraph, vfs: &mut Vfs) -> BatchDatabase {
45 let mut db = BatchDatabase { runtime: salsa::Runtime::default() }; 45 let mut db = BatchDatabase { runtime: salsa::Runtime::default() };
46 db.query_mut(ra_db::ParseQuery).set_lru_capacity(128);
47 db.query_mut(ra_hir::db::ParseMacroQuery).set_lru_capacity(128);
46 db.set_crate_graph(Arc::new(crate_graph)); 48 db.set_crate_graph(Arc::new(crate_graph));
47 49
48 // wait until Vfs has loaded all roots 50 // wait until Vfs has loaded all roots
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml
index 827855b2f..f73dd739a 100644
--- a/crates/ra_db/Cargo.toml
+++ b/crates/ra_db/Cargo.toml
@@ -5,7 +5,7 @@ version = "0.1.0"
5authors = ["rust-analyzer developers"] 5authors = ["rust-analyzer developers"]
6 6
7[dependencies] 7[dependencies]
8salsa = "0.12.1" 8salsa = "0.12.3"
9relative-path = "0.4.0" 9relative-path = "0.4.0"
10rustc-hash = "1.0" 10rustc-hash = "1.0"
11 11
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs
index 247dc0fee..ce03a0f95 100644
--- a/crates/ra_ide_api/src/change.rs
+++ b/crates/ra_ide_api/src/change.rs
@@ -225,7 +225,6 @@ impl RootDatabase {
225 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); 225 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions();
226 226
227 self.query(ra_db::ParseQuery).sweep(sweep); 227 self.query(ra_db::ParseQuery).sweep(sweep);
228
229 self.query(hir::db::ParseMacroQuery).sweep(sweep); 228 self.query(hir::db::ParseMacroQuery).sweep(sweep);
230 self.query(hir::db::MacroDefQuery).sweep(sweep); 229 self.query(hir::db::MacroDefQuery).sweep(sweep);
231 self.query(hir::db::MacroArgQuery).sweep(sweep); 230 self.query(hir::db::MacroArgQuery).sweep(sweep);
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs
index d1a452ecb..4f19b01c4 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -5,7 +5,7 @@ use std::{
5 5
6use ra_db::{ 6use ra_db::{
7 CheckCanceled, FileId, Canceled, SourceDatabase, 7 CheckCanceled, FileId, Canceled, SourceDatabase,
8 salsa, 8 salsa::{self, Database},
9}; 9};
10 10
11use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}}; 11use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}};
@@ -49,6 +49,8 @@ impl Default for RootDatabase {
49 db.set_crate_graph(Default::default()); 49 db.set_crate_graph(Default::default());
50 db.set_local_roots(Default::default()); 50 db.set_local_roots(Default::default());
51 db.set_library_roots(Default::default()); 51 db.set_library_roots(Default::default());
52 db.query_mut(ra_db::ParseQuery).set_lru_capacity(128);
53 db.query_mut(hir::db::ParseMacroQuery).set_lru_capacity(128);
52 db 54 db
53 } 55 }
54} 56}