Skip to content

Commit

Permalink
call shrink_to_fit() on roaring bitmaps (#27)
Browse files Browse the repository at this point in the history
* bitmap shrink_to_fit

* one more
  • Loading branch information
lwwmanning authored Feb 27, 2024
1 parent 2a901df commit d3ef519
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions vortex-roaring/src/boolean/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub fn roaring_encode(bool_array: &BoolArray) -> RoaringBoolArray {
.map(|(i, _)| i as u32),
);
bitmap.run_optimize();
bitmap.shrink_to_fit();

RoaringBoolArray::new(bitmap, bool_array.buffer().len())
}
1 change: 1 addition & 0 deletions vortex-roaring/src/integer/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ fn roaring_encode_primitive<T: NumCast + NativePType>(values: &[T]) -> RoaringIn
let mut bitmap = Bitmap::new();
bitmap.extend(values.iter().map(|i| i.to_u32().unwrap()));
bitmap.run_optimize();
bitmap.shrink_to_fit();
RoaringIntArray::new(bitmap, T::PTYPE)
}

0 comments on commit d3ef519

Please sign in to comment.