Hi, I'm trying to make the below code faster:
let mut ids: Vec<HashMap<u64, [u8; 6], BuildNoHashHasher<u64>>> = (0..ids_to_add.len())
.map(|_| HashMap::with_capacity_and_hasher(1,BuildNoHashHasher::default()))
.collect();
Most of the time is fine and it take less then 5 ms for ~70000 elements. But some time the required time to create the above vector skyrocket, below and example from real data.
number of elements 77535. One time it took, 2.592765ms another 483.893362ms I took to extremes.
I'm wondering if there is a more consistent way to allocate a bunch of hashmaps when I know capacity and number of elements. Capacity is known at compile time number of elements at runtime.