diff options
author | Aleksey Kladov <[email protected]> | 2019-06-07 10:46:49 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-06-12 11:25:30 +0100 |
commit | 15668119de40b97011a1f2e2d065d11f25a5833a (patch) | |
tree | 97b9523db35f07d1f5cb9df458a4bcdac323063d /crates/ra_batch | |
parent | fc2658b0749b03f365a3f176582311efd2bc6462 (diff) |
make LRU_CAP configurable for batch db
Diffstat (limited to 'crates/ra_batch')
-rw-r--r-- | crates/ra_batch/src/lib.rs | 8 |
1 files changed, 6 insertions, 2 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 { | |||
43 | impl BatchDatabase { | 43 | impl 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 |