Skip to content

Commit ef60b78

Browse files
authored
Merge pull request #19378 from davidbarsky/davidbarsky/run-lru-at-end-of-analysis-stats
analysis-stats: run Salsa's LRU at the end of analysis
2 parents b03af79 + fa89f29 commit ef60b78

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ use ide::{
2222
Analysis, AnalysisHost, AnnotationConfig, DiagnosticsConfig, Edition, InlayFieldsToResolve,
2323
InlayHintsConfig, LineCol, RootDatabase,
2424
};
25-
use ide_db::{EditionedFileId, LineIndexDatabase, SnippetCap, base_db::SourceDatabase};
25+
use ide_db::{
26+
EditionedFileId, LineIndexDatabase, SnippetCap,
27+
base_db::{SourceDatabase, salsa::Database},
28+
};
2629
use itertools::Itertools;
2730
use load_cargo::{LoadCargoConfig, ProcMacroServerChoice, load_workspace};
2831
use oorandom::Rand32;
@@ -104,7 +107,7 @@ impl flags::AnalysisStats {
104107
}
105108
eprintln!(")");
106109

107-
let host = AnalysisHost::with_database(db);
110+
let mut host = AnalysisHost::with_database(db);
108111
let db = host.raw_database();
109112

110113
let mut analysis_sw = self.stop_watch();
@@ -250,6 +253,9 @@ impl flags::AnalysisStats {
250253
self.run_term_search(&workspace, db, &vfs, file_ids, verbosity);
251254
}
252255

256+
let db = host.raw_database_mut();
257+
db.trigger_lru_eviction();
258+
253259
let total_span = analysis_sw.elapsed();
254260
eprintln!("{:<20} {total_span}", "Total:");
255261
report_metric("total time", total_span.time.as_millis() as u64, "ms");

0 commit comments

Comments
 (0)