mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
Merge #3788
3788: Use `RoaringBitmap::deserialize_unchecked_from` to reduce the deserialization time r=irevoire a=Kerollmops This pull request replaces the `RoaringBitmap::deserialize_from` methods with the `deserialize_unchecked_from` to avoid doing too much checks. We know the written bitmaps are valid as we do not disable the checks during the indexation phase. I did a small test with #3780 and discovered that the deserialization time changed from 32% to 9.46% when using these changes. It seems it was low-hanging fruit hidden behind a leaf. Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
commit
f517274d1f
@ -49,7 +49,7 @@ impl CboRoaringBitmapCodec {
|
|||||||
} else {
|
} else {
|
||||||
// Otherwise, it means we used the classic RoaringBitmapCodec and
|
// Otherwise, it means we used the classic RoaringBitmapCodec and
|
||||||
// that the header takes threshold integers.
|
// that the header takes threshold integers.
|
||||||
RoaringBitmap::deserialize_from(bytes)
|
RoaringBitmap::deserialize_unchecked_from(bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ impl CboRoaringBitmapCodec {
|
|||||||
vec.push(integer);
|
vec.push(integer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
roaring |= RoaringBitmap::deserialize_from(bytes.as_ref())?;
|
roaring |= RoaringBitmap::deserialize_unchecked_from(bytes.as_ref())?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ impl heed::BytesDecode<'_> for RoaringBitmapCodec {
|
|||||||
type DItem = RoaringBitmap;
|
type DItem = RoaringBitmap;
|
||||||
|
|
||||||
fn bytes_decode(bytes: &[u8]) -> Option<Self::DItem> {
|
fn bytes_decode(bytes: &[u8]) -> Option<Self::DItem> {
|
||||||
RoaringBitmap::deserialize_from(bytes).ok()
|
RoaringBitmap::deserialize_unchecked_from(bytes).ok()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user