2 additional precent won by reserving the memory before pushing in the vec

This commit is contained in:
Tamo 2023-10-24 16:03:10 +02:00
parent 01b1effec0
commit 4696b8199f

View File

@ -71,6 +71,7 @@ impl CboRoaringBitmapCodec {
for bytes in slices {
if bytes.len() <= THRESHOLD * size_of::<u32>() {
debug_assert!(bytes.len() % size_of::<u32>() == 0);
vec.reserve(bytes.len() / size_of::<u32>());
for bytes in bytes.chunks_exact(size_of::<u32>()) {
// unwrap can't happens since we ensured that everything