xacrimon / dashmap

Blazing fast concurrent HashMap for Rust.
MIT License
2.84k stars 140 forks source link

Avoid overallocating or growing Vec in Clone #295

Open GnomedDev opened 4 months ago

GnomedDev commented 4 months ago

We can collect directly into the Box<[T]> to avoid pushing to a Vec, which could overallocate and require a reallocation when shrinking in Vec::into_boxed_slice or have to reallocate multiple times as it wouldn't know the finishing capacity.