aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_batch/src/lib.rs8
-rw-r--r--crates/ra_db/src/lib.rs2
-rw-r--r--crates/ra_ide_api/src/db.rs5
3 files changed, 11 insertions, 4 deletions
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index 02ea89306..c59821f44 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -43,8 +43,12 @@ 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); 46 let lru_cap = std::env::var("RA_LRU_CAP")
47 db.query_mut(ra_hir::db::ParseMacroQuery).set_lru_capacity(128); 47 .ok()
48 .and_then(|it| it.parse::<usize>().ok())
49 .unwrap_or(ra_db::DEFAULT_LRU_CAP);
50 db.query_mut(ra_db::ParseQuery).set_lru_capacity(lru_cap);
51 db.query_mut(ra_hir::db::ParseMacroQuery).set_lru_capacity(lru_cap);
48 db.set_crate_graph(Arc::new(crate_graph)); 52 db.set_crate_graph(Arc::new(crate_graph));
49 53
50 // wait until Vfs has loaded all roots 54 // wait until Vfs has loaded all roots
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs
index 7c49c585b..f08616100 100644
--- a/crates/ra_db/src/lib.rs
+++ b/crates/ra_db/src/lib.rs
@@ -65,6 +65,8 @@ pub struct FileRange {
65 pub range: TextRange, 65 pub range: TextRange,
66} 66}
67 67
68pub const DEFAULT_LRU_CAP: usize = 128;
69
68/// Database which stores all significant input facts: source code and project 70/// Database which stores all significant input facts: source code and project
69/// model. Everything else in rust-analyzer is derived from these queries. 71/// model. Everything else in rust-analyzer is derived from these queries.
70#[salsa::query_group(SourceDatabaseStorage)] 72#[salsa::query_group(SourceDatabaseStorage)]
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs
index 4f19b01c4..cccf0ada4 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -49,8 +49,9 @@ 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); 52 let lru_cap = ra_db::DEFAULT_LRU_CAP;
53 db.query_mut(hir::db::ParseMacroQuery).set_lru_capacity(128); 53 db.query_mut(ra_db::ParseQuery).set_lru_capacity(lru_cap);
54 db.query_mut(hir::db::ParseMacroQuery).set_lru_capacity(lru_cap);
54 db 55 db
55 } 56 }
56} 57}