Dev & Code 2 h agoAdd to bookmarks

An article from 2024, which topped Hacker News today, shows how a better-designed memory layout makes a static structure 40× faster than a binary search. The real lesson isn't the number—it's the reasoning.
Except that… in 2026, on a modern CPU, binary search is catastrophic. Why? Because each comparison reads a slot whose address depends on the previous result. The processor can neither predict, nor preload, nor pipeline. At each step, it waits for the cache miss (about 100 CPU cycles, or ~30 ns on recent DDR5).
The article « Static search trees: 40x faster than binary search » (2024, republished at the top of HN today) digs exactly into this problem. The proposed solution is a static B-tree - not a dynamic B-tree from a database manual, but a version optimized for the CPU:
__builtin_prefetch) of the probable child node.Result measured in the article: on 100 million entries, the search goes from about 150 ns to 4 ns. That's 40× faster.
The lesson is not « binary search is dead ». It's that classical algorithmic complexity (O log n) ignores the memory cache. On a modern CPU, the structure that minimizes cache misses almost always beats the one that minimizes comparisons.
Other examples we encounter in our projects:
flat_hash_map) vs. classic std::HashMap.slice::sort_unstable) vs. school quicksort.static-search-tree or equivalent for a productive example.When you optimize a hot loop, your first profiler to pull out is not cachegrind - it's perf stat -e cache-misses,cache-references under Linux (or Instruments on macOS). That's where the real performance is at in 2026. Complexity theory tells you what's possible; the memory cache tells you what's achievable.
Article produced by artificial intelligence, reviewed under human editorial control.