Measure and improve the constant numbers used when building the tree
Kerollmops opened this issue · comments
Clément Renault commented
We must take three parameters into account:
- Time to build the tree
- Relevancy of the searches
- Time to search in the tree
Fun fact: the lowest in the tree you are, the less impact a dummy plane has on the search cost.
Lines 248 to 259 in 7fc6031
fn split_imbalance(left_indices_len: usize, right_indices_len: usize) -> f64 {
let ls = left_indices_len as f64;
let rs = right_indices_len as f64;
let f = ls / (ls + rs + f64::EPSILON); // Avoid 0/0
f.max(1.0 - f)
}
fn main() {
dbg!(split_imbalance(29464, 18394));
dbg!(split_imbalance(30000, 30000));
dbg!(split_imbalance(30000, 1580));
}