Skip to content

Some pointers for which variants to use #3

@jonhoo

Description

@jonhoo

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:

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

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions