Avoid reallocation with the ThreadLocal pool

This commit is contained in:
Clément Renault 2024-10-07 16:41:17 +02:00
parent 83c09d0db0
commit eb09dfed04
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
3 changed files with 3 additions and 3 deletions

View File

@ -211,7 +211,7 @@ impl DocidsExtractor for FacetedDocidsExtractor {
let attributes_to_extract = Self::attributes_to_extract(&rtxn, index)?;
let attributes_to_extract: Vec<_> =
attributes_to_extract.iter().map(|s| s.as_ref()).collect();
let thread_local = ThreadLocal::new();
let thread_local = ThreadLocal::with_capacity(rayon::current_num_threads());
{
let span =

View File

@ -342,7 +342,7 @@ impl WordDocidsExtractors {
max_positions_per_attributes: MAX_POSITION_PER_ATTRIBUTE,
};
let thread_local = ThreadLocal::new();
let thread_local = ThreadLocal::with_capacity(rayon::current_num_threads());
{
let span =

View File

@ -60,7 +60,7 @@ pub trait SearchableExtractor {
max_positions_per_attributes: MAX_POSITION_PER_ATTRIBUTE,
};
let thread_local = ThreadLocal::new();
let thread_local = ThreadLocal::with_capacity(rayon::current_num_threads());
{
let span =