fn initial_table_size(per_thread_memory_budget: usize) -> Result<usize> {
    let table_memory_upper_bound = per_thread_memory_budget / 3;
    if let Some(limit) = (10..)
        .take_while(|num_bits: &usize| compute_table_size(*num_bits) < table_memory_upper_bound)
        .last()
    {
        Ok(limit.min(19)) // we cap it at 2^19 = 512K.
    } else {
        Err(TantivyError::InvalidArgument(
            format!("per thread memory budget (={}) is too small. Raise the memory budget or lower the number of threads.", per_thread_memory_budget)))
    }
}
/// Computes the initial size of the hash table.
///
/// Returns a number of bit `b`, such that the recommended initial table size is 2^b.
Computes the initial size of the hash table.
Returns a number of bit `b`, such that the recommended initial table size is 2^b.
Computes the initial size of the hash table . Returns a number of bit ` b ` such that the recommended initial table size is 2^b .
fn initial_table_size(per_thread_memory_budget: usize) -> Result<usize> {
    let table_memory_upper_bound = per_thread_memory_budget / 3;
    if let Some(limit) = (10..)
        .take_while(|num_bits: &usize| compute_table_size(*num_bits) < table_memory_upper_bound)
        .last()
    {
        Ok(limit.min(19)) // we cap it at 2^19 = 512K.
    } else {
        Err(TantivyError::InvalidArgument(
            format!("per thread memory budget (={}) is too small. Raise the memory budget or lower the number of threads.", per_thread_memory_budget)))
    }
}
fn initial_table_size ( per_thread_memory_budget : usize ) -> Result < usize > { let table_memory_upper_bound = per_thread_memory_budget / 3 ; if let Some ( limit ) = ( 10 .. ) . take_while ( | num_bits : & usize | compute_table_size ( * num_bits ) < table_memory_upper_bound ) . last ( ) { Ok ( limit . min ( 19 ) ) // we cap it at 2^19 = 512K. } else { Err ( TantivyError :: InvalidArgument ( format ! ( " " per_thread_memory_budget ) ) ) } }
Computes the initial size of the hash table.
Computes the initial size of the hash table .
per_thread_memory_budget
usize
per_thread_memory_budget
usize