From 00a03742ff65f6408769e4056315779cea264c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 9 Jan 2025 10:21:33 +0100 Subject: [PATCH] Prefer using extend when merging bitmaps than unions (less allocations) --- crates/milli/src/update/new/extract/cache.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/milli/src/update/new/extract/cache.rs b/crates/milli/src/update/new/extract/cache.rs index e2c8bb5fe..47bca6193 100644 --- a/crates/milli/src/update/new/extract/cache.rs +++ b/crates/milli/src/update/new/extract/cache.rs @@ -679,9 +679,7 @@ impl DelAddRoaringBitmap { let del = self.del.get_or_insert_with(RoaringBitmap::new); let mut iter = bbbul.iter_and_clear(); while let Some(block) = iter.next_block() { - let iter = block.iter().copied(); - let block = RoaringBitmap::from_sorted_iter(iter).unwrap(); - *del |= block; + del.extend(block); } } @@ -689,9 +687,7 @@ impl DelAddRoaringBitmap { let add = self.add.get_or_insert_with(RoaringBitmap::new); let mut iter = bbbul.iter_and_clear(); while let Some(block) = iter.next_block() { - let iter = block.iter().copied(); - let block = RoaringBitmap::from_sorted_iter(iter).unwrap(); - *add |= block; + add.extend(block); } } }