40x Faster Binary Search
summary
Claims that binary search is only a small constant slower than random access but in practice slows hugely because cache misses dominate, then demonstrates concrete fixes: replace naive layout with Eytzinger layout, pack nodes into cache-line blocks (16 32-bit ints), use AVX2 SIMD (portable SIMD popcount trick), remove branches, optimize pointer arithmetic, add batching 16 and staggered batches + prefetch. Implementation beats the Rust standard library by 40x faster, drops ~1µs to ~27ns per query on large arrays; the optimized version reliably works and increases throughput.
AI-written summary · about
