Always sort internal Sorter entries in parallel

This commit is contained in:
Clément Renault 2023-11-02 14:47:43 +01:00
parent b10c060bf7
commit 4d864f0702
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
2 changed files with 17 additions and 35 deletions

View File

@ -47,6 +47,7 @@ pub fn create_sorter(
builder.allow_realloc(false);
}
builder.sort_algorithm(sort_algorithm);
builder.sort_in_parallel(true);
builder.build()
}

View File

@ -114,43 +114,24 @@ impl<'a, 'i> Transform<'a, 'i> {
};
// We initialize the sorter with the user indexing settings.
let original_sorter = {
let mut builder = grenad::Sorter::builder(merge_function);
builder.chunk_compression_type(indexer_settings.chunk_compression_type);
if let Some(level) = indexer_settings.chunk_compression_level {
builder.chunk_compression_level(level);
}
if let Some(nb_chunks) = indexer_settings.max_nb_chunks {
builder.max_nb_chunks(nb_chunks);
}
if let Some(memory) = indexer_settings.max_memory.map(|mem| mem / 2) {
builder.dump_threshold(memory);
builder.allow_realloc(false);
}
builder.sort_algorithm(grenad::SortAlgorithm::Stable);
builder.sort_in_parallel(true);
builder.build()
};
let original_sorter = create_sorter(
grenad::SortAlgorithm::Stable,
merge_function,
indexer_settings.chunk_compression_type,
indexer_settings.chunk_compression_level,
indexer_settings.max_nb_chunks,
indexer_settings.max_memory.map(|mem| mem / 2),
);
// We initialize the sorter with the user indexing settings.
let flattened_sorter = {
let mut builder = grenad::Sorter::builder(merge_function);
builder.chunk_compression_type(indexer_settings.chunk_compression_type);
if let Some(level) = indexer_settings.chunk_compression_level {
builder.chunk_compression_level(level);
}
if let Some(nb_chunks) = indexer_settings.max_nb_chunks {
builder.max_nb_chunks(nb_chunks);
}
if let Some(memory) = indexer_settings.max_memory.map(|mem| mem / 2) {
builder.dump_threshold(memory);
builder.allow_realloc(false);
}
builder.sort_algorithm(grenad::SortAlgorithm::Stable);
builder.sort_in_parallel(true);
builder.build()
};
let flattened_sorter = create_sorter(
grenad::SortAlgorithm::Stable,
merge_function,
indexer_settings.chunk_compression_type,
indexer_settings.chunk_compression_level,
indexer_settings.max_nb_chunks,
indexer_settings.max_memory.map(|mem| mem / 2),
);
let documents_ids = index.documents_ids(wtxn)?;
Ok(Transform {