-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Following a discussion over at gimli-rs/addr2line#61 (comment), I'm thinking of implementing the Eytzinger array-based search in Rust. But, looking through https://github.com/patmorin/arraylayout/blob/master/src/eytzinger_array.h, it's not immediately clear to me which of the variants would be the appropriate one to implement.
If I'm reading the paper correctly:
arraylayout/src/eytzinger_array.h
Line 128 in 3f20174
| I __attribute__ ((noinline)) eytzinger_array_deeppf<T,I,C,aligned>::search(T x) const { |
should be used when the size of
T is small (roughly < 8 bytes), and
arraylayout/src/eytzinger_array.h
Line 253 in 3f20174
| I __attribute__ ((noinline)) eytzinger_array_bfpm<T,I,aligned>::search(T x) const { |
should be used as the general implementation for all
T.
Are those conclusions mostly correct? Which would suggest that I should implement the latter of the two first, and then possibly add a variant for small T using the former.
I also noticed there's an "unrolled" version of the algorithm:
arraylayout/src/eytzinger_array.h
Line 266 in 3f20174
| I __attribute__ ((noinline)) eytzinger_array_unrolled<T, I, aligned>::search(T x) const { |
which is not evaluated in the paper? Is that something worth paying attention to?