Curious Coding is a blog about fast algorithms and data structures, with posts on search trees, hashing, SIMD and Rust.
HN links its static search trees post, which drew a large discussion of how it beats binary search by a wide margin.
Hmm, bitmaps is an interesting idea! If the data is dense enough, then yeah I guess a quick linear scan would work.
There's also the extreme of simply storing the answer for each possible query as a u32 and just index the array, but there the overhead is much larger.
Rank-select is also interesting, but I doubt it comes anywhere close in performance.
I happen to also be working on a minimal perfect hashing project that has way higher throughput than other methods (mostly because batching), see https://curiouscoding.nl/posts/ptrhash-paper/ and the first post linked from there.
See also: Static search trees: 40x faster than binary search
- https://curiouscoding.nl/slides/p99-text/
- https://curiouscoding.nl/posts/static-search-tree/
- https://news.ycombinator.com/item?id=42562847 (656 points; 232 comments)
When this was posted to lobsters someone shared this relevant link: https://curiouscoding.nl/posts/static-search-tree/