diff --git a/crates/milli/src/update/new/indexer/document_operation.rs b/crates/milli/src/update/new/indexer/document_operation.rs index 3be6cc080..7beffc7fc 100644 --- a/crates/milli/src/update/new/indexer/document_operation.rs +++ b/crates/milli/src/update/new/indexer/document_operation.rs @@ -94,6 +94,7 @@ impl<'pl> DocumentOperation<'pl> { while let Some(document) = iter.next().transpose().map_err(UserError::SerdeJson)? { + // TODO Do not allocate when it is not necessary let external_document_id = primary_key.extract_fields_and_docid( document, new_fields_ids_map, @@ -198,6 +199,7 @@ impl<'pl> DocumentOperation<'pl> { }; // And finally sort them + // TODO Can we sort in parallel? docids_version_offsets.sort_unstable_by_key(|(_, (_, docops))| sort_function_key(docops)); let docids_version_offsets = docids_version_offsets.into_bump_slice(); Ok(DocumentOperationChanges {