Skip to content

Commit c8aa2f6

Browse files
committed
use index map
1 parent 5f0c1aa commit c8aa2f6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

crates/ide/src/prime_caches.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
mod topologic_sort;
66

77
use hir::db::DefDatabase;
8-
use ide_db::base_db::{
9-
salsa::{Database, ParallelDatabase, Snapshot},
10-
CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt,
8+
use ide_db::{
9+
base_db::{
10+
salsa::{Database, ParallelDatabase, Snapshot},
11+
CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt,
12+
},
13+
FxIndexMap,
1114
};
1215
use rustc_hash::{FxHashMap, FxHashSet};
1316

@@ -105,8 +108,11 @@ pub(crate) fn parallel_prime_caches(
105108

106109
let crates_total = crates_to_prime.len();
107110
let mut crates_done = 0;
111+
112+
// an index map is used to preserve ordering so we can sort the progress report in order of
113+
// "longest crate to index" first
108114
let mut crates_currently_indexing =
109-
FxHashMap::with_capacity_and_hasher(num_worker_threads as _, Default::default());
115+
FxIndexMap::with_capacity_and_hasher(num_worker_threads as _, Default::default());
110116

111117
while !crates_to_prime.is_empty() {
112118
db.unwind_if_cancelled();

0 commit comments

Comments
 (0)