From da04edff8c6b032d70fe58500c530d8b44cd04e1 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 30 May 2023 14:49:32 +0200 Subject: [PATCH] Better use deserialize_unchecked_from to reduce the deserialization time --- .../src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs | 4 ++-- milli/src/heed_codec/roaring_bitmap/roaring_bitmap_codec.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/milli/src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs b/milli/src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs index 1bd132974..01ce523ba 100644 --- a/milli/src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs +++ b/milli/src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs @@ -49,7 +49,7 @@ impl CboRoaringBitmapCodec { } else { // Otherwise, it means we used the classic RoaringBitmapCodec and // that the header takes threshold integers. - RoaringBitmap::deserialize_from(bytes) + RoaringBitmap::deserialize_unchecked_from(bytes) } } @@ -69,7 +69,7 @@ impl CboRoaringBitmapCodec { vec.push(integer); } } else { - roaring |= RoaringBitmap::deserialize_from(bytes.as_ref())?; + roaring |= RoaringBitmap::deserialize_unchecked_from(bytes.as_ref())?; } } diff --git a/milli/src/heed_codec/roaring_bitmap/roaring_bitmap_codec.rs b/milli/src/heed_codec/roaring_bitmap/roaring_bitmap_codec.rs index 8fae9b8fd..6cec0eb44 100644 --- a/milli/src/heed_codec/roaring_bitmap/roaring_bitmap_codec.rs +++ b/milli/src/heed_codec/roaring_bitmap/roaring_bitmap_codec.rs @@ -8,7 +8,7 @@ impl heed::BytesDecode<'_> for RoaringBitmapCodec { type DItem = RoaringBitmap; fn bytes_decode(bytes: &[u8]) -> Option { - RoaringBitmap::deserialize_from(bytes).ok() + RoaringBitmap::deserialize_unchecked_from(bytes).ok() } }