Skip to content

Commit 4f52199

Browse files
committed
Auto merge of rust-lang#137563 - FractalFir:dep_graph_cap, r=nnethercote
Change TaskDeps to start preallocated with 128 capacity This is a tiny change that makes `TaskDeps::read_set` start preallocated with capacity for 128 elements. From local profiling, it looks like `TaskDeps::read_set` is one of the most-often resized hash-sets in `rustc`.
2 parents a96fa31 + e100fd4 commit 4f52199

File tree

1 file changed

+1
-2
lines changed
  • compiler/rustc_query_system/src/dep_graph

1 file changed

+1
-2
lines changed

Diff for: compiler/rustc_query_system/src/dep_graph/graph.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1299,12 +1299,11 @@ impl Default for TaskDeps {
12991299
#[cfg(debug_assertions)]
13001300
node: None,
13011301
reads: EdgesVec::new(),
1302-
read_set: FxHashSet::default(),
1302+
read_set: FxHashSet::with_capacity_and_hasher(128, Default::default()),
13031303
phantom_data: PhantomData,
13041304
}
13051305
}
13061306
}
1307-
13081307
// A data structure that stores Option<DepNodeColor> values as a contiguous
13091308
// array, using one u32 per entry.
13101309
struct DepNodeColorMap {

0 commit comments

Comments
 (0)