diff --git a/milli/src/update/new/extract/cache.rs b/milli/src/update/new/extract/cache.rs index 5e90b1c79..00b4dc46d 100644 --- a/milli/src/update/new/extract/cache.rs +++ b/milli/src/update/new/extract/cache.rs @@ -198,30 +198,29 @@ impl DelAddRoaringBitmap { #[derive(Debug, Clone, Default)] struct PushOptimizedBitmap { - max: Option, bitmap: RoaringBitmap, } impl PushOptimizedBitmap { + #[inline] fn from_bitmap(bitmap: RoaringBitmap) -> PushOptimizedBitmap { - PushOptimizedBitmap { max: bitmap.max(), bitmap } + PushOptimizedBitmap { bitmap } } + #[inline] fn from_single(single: u32) -> PushOptimizedBitmap { - PushOptimizedBitmap { max: Some(single), bitmap: RoaringBitmap::from([single]) } + PushOptimizedBitmap { bitmap: RoaringBitmap::from([single]) } } + #[inline] fn insert(&mut self, n: u32) { - if self.max.map_or(true, |max| n > max) { - self.max = Some(n); - self.bitmap.push(n); - } else { + if !self.bitmap.push(n) { self.bitmap.insert(n); } } + #[inline] fn union_with_bitmap(&mut self, bitmap: RoaringBitmap) { self.bitmap |= bitmap; - self.max = self.bitmap.max(); } }