Replace the bumpalo HashMap with a normal one

This commit is contained in:
Clément Renault 2024-11-07 17:42:47 +01:00
parent 1f5d801271
commit 745bcaa23d
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -2,6 +2,7 @@ use bumpalo::collections::CollectIn;
use bumpalo::Bump; use bumpalo::Bump;
use heed::RoTxn; use heed::RoTxn;
use memmap2::Mmap; use memmap2::Mmap;
use rayon::prelude::IndexedParallelIterator;
use rayon::slice::ParallelSlice; use rayon::slice::ParallelSlice;
use serde_json::value::RawValue; use serde_json::value::RawValue;
use IndexDocumentsMethod as Idm; use IndexDocumentsMethod as Idm;
@ -80,8 +81,7 @@ impl<'pl> DocumentOperation<'pl> {
let documents_ids = index.documents_ids(rtxn)?; let documents_ids = index.documents_ids(rtxn)?;
let mut available_docids = AvailableIds::new(&documents_ids); let mut available_docids = AvailableIds::new(&documents_ids);
let mut docids_version_offsets = let mut docids_version_offsets = hashbrown::HashMap::<&'pl str, _, _, _>::new();
hashbrown::HashMap::<&'pl str, _, _, _>::new_in(&document_changes_alloc);
for operation in self.operations { for operation in self.operations {
match operation { match operation {
@ -213,7 +213,7 @@ impl<'pl> DocumentChanges<'pl> for DocumentOperationChanges<'pl> {
fn iter( fn iter(
&self, &self,
chunk_size: usize, chunk_size: usize,
) -> impl rayon::prelude::IndexedParallelIterator<Item = impl AsRef<[Self::Item]>> { ) -> impl IndexedParallelIterator<Item = impl AsRef<[Self::Item]>> {
self.docids_version_offsets.par_chunks(chunk_size) self.docids_version_offsets.par_chunks(chunk_size)
} }