Skip to content

Commit 3394481

Browse files
Only prefill caches in the completion benchmark
1 parent b24f816 commit 3394481

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

crates/rust-analyzer/src/cli/analysis_stats.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ impl AnalysisStatsCmd {
7070
load_out_dirs_from_check: self.enable_build_scripts,
7171
wrap_rustc: false,
7272
with_proc_macro: self.enable_proc_macros,
73+
prefill_caches: false,
7374
};
7475
let (host, vfs, _proc_macro) =
7576
load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?;

crates/rust-analyzer/src/cli/diagnostics.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ pub fn diagnostics(
3434
with_proc_macro: bool,
3535
) -> Result<()> {
3636
let cargo_config = Default::default();
37-
let load_cargo_config =
38-
LoadCargoConfig { load_out_dirs_from_check, with_proc_macro, wrap_rustc: false };
37+
let load_cargo_config = LoadCargoConfig {
38+
load_out_dirs_from_check,
39+
with_proc_macro,
40+
wrap_rustc: false,
41+
prefill_caches: false,
42+
};
3943
let (host, _vfs, _proc_macro) =
4044
load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?;
4145
let db = host.raw_database();

crates/rust-analyzer/src/cli/load_cargo.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub(crate) struct LoadCargoConfig {
1818
pub(crate) load_out_dirs_from_check: bool,
1919
pub(crate) wrap_rustc: bool,
2020
pub(crate) with_proc_macro: bool,
21+
pub(crate) prefill_caches: bool,
2122
}
2223

2324
pub(crate) fn load_workspace_at(
@@ -83,7 +84,9 @@ fn load_workspace(
8384
let host =
8485
load_crate_graph(crate_graph, project_folders.source_root_config, &mut vfs, &receiver);
8586

86-
host.analysis().prime_caches(|_| {})?;
87+
if config.prefill_caches {
88+
host.analysis().prime_caches(|_| {})?;
89+
}
8790
Ok((host, vfs, proc_macro_client))
8891
}
8992

@@ -146,6 +149,7 @@ mod tests {
146149
load_out_dirs_from_check: false,
147150
wrap_rustc: false,
148151
with_proc_macro: false,
152+
prefill_caches: false,
149153
};
150154
let (host, _vfs, _proc_macro) =
151155
load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?;

crates/rust-analyzer/src/cli/ssr.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
1313
load_out_dirs_from_check: true,
1414
wrap_rustc: false,
1515
with_proc_macro: true,
16+
prefill_caches: false,
1617
};
1718
let (host, vfs, _proc_macro) =
1819
load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?;
@@ -39,8 +40,12 @@ pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<Stri
3940
use ide_db::base_db::SourceDatabaseExt;
4041
use ide_db::symbol_index::SymbolsDatabase;
4142
let cargo_config = Default::default();
42-
let load_cargo_config =
43-
LoadCargoConfig { load_out_dirs_from_check: true, wrap_rustc: true, with_proc_macro: true };
43+
let load_cargo_config = LoadCargoConfig {
44+
load_out_dirs_from_check: true,
45+
wrap_rustc: true,
46+
with_proc_macro: true,
47+
prefill_caches: false,
48+
};
4449
let (host, _vfs, _proc_macro) =
4550
load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?;
4651
let db = host.raw_database();

crates/rust-analyzer/src/integrated_benchmarks.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ fn integrated_highlighting_benchmark() {
3737
load_out_dirs_from_check: true,
3838
wrap_rustc: false,
3939
with_proc_macro: false,
40+
prefill_caches: false,
4041
};
4142

4243
let (mut host, vfs, _proc_macro) = {
@@ -91,6 +92,7 @@ fn integrated_completion_benchmark() {
9192
load_out_dirs_from_check: true,
9293
wrap_rustc: false,
9394
with_proc_macro: false,
95+
prefill_caches: true,
9496
};
9597

9698
let (mut host, vfs, _proc_macro) = {

0 commit comments

Comments
 (0)