aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_batch
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-06-12 11:36:47 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-06-12 11:36:47 +0100
commit03645c55761f8c9345ee3837a6010e65e7a80179 (patch)
tree9c24cb112429b0334762063e71a65a1907386e59 /crates/ra_batch
parent6296f51678843c96a4ab1f1e6784b6d69222e072 (diff)
parentfed52706def9a9f5d33edc7dd9848a02ae475ba5 (diff)
Merge #1382
1382: use salsa's LRU for syntax trees r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_batch')
-rw-r--r--crates/ra_batch/src/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index a445dcb4d..c59821f44 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,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 let lru_cap = std::env::var("RA_LRU_CAP")
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);
46 db.set_crate_graph(Arc::new(crate_graph)); 52 db.set_crate_graph(Arc::new(crate_graph));
47 53
48 // wait until Vfs has loaded all roots 54 // wait until Vfs has loaded all roots