hash_keys bench: use HashSet::with_capacity (#11044)

This commit is contained in:
nk_ysg
2024-09-19 23:07:44 +08:00
committed by GitHub
parent 0349d7b289
commit 893ea95d3e

View File

@ -161,7 +161,7 @@ where
let mut preload = strategy.new_tree(&mut runner).unwrap().current();
let mut input = strategy.new_tree(&mut runner).unwrap().current();
let mut unique_keys = HashSet::new();
let mut unique_keys = HashSet::with_capacity(preload.len() + input.len());
preload.retain(|(k, _)| unique_keys.insert(k.clone()));
input.retain(|(k, _)| unique_keys.insert(k.clone()));