Plug the grenad max memory parameter

This commit is contained in:
Clément Renault 2024-11-18 11:25:37 +01:00
parent 9150c8f052
commit 5b4c06c24c
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
8 changed files with 32 additions and 25 deletions

View file

@ -119,12 +119,8 @@ impl GrenadParameters {
///
/// This should be called inside of a rayon thread pool,
/// otherwise, it will take the global number of threads.
///
/// The max memory cannot exceed a given reasonable value.
pub fn max_memory_by_thread(&self) -> Option<usize> {
self.max_memory.map(|max_memory| {
(max_memory / rayon::current_num_threads()).min(MAX_GRENAD_SORTER_USAGE)
})
self.max_memory.map(|max_memory| (max_memory / rayon::current_num_threads()))
}
}