
HNSW
An approximate nearest-neighbor search index built from scratch in C++, with SIMD distance math, parallel builds, and memory-mapped loading.
C++SIMDMultithreading
- Distance math uses ARM NEON SIMD with four independent accumulators over 16 floats per iteration.
- The index builds in parallel: threads take work from an atomic counter and lock neighbors through 4,096 striped shared locks instead of one lock per node. Levels are drawn up front so the graph does not depend on thread count.
- Queries reuse thread-local scratch space and an epoch-stamped visited set, so nothing is cleared between searches.
- The on-disk format uses 64-byte-aligned sections and loads zero-copy with mmap; in-memory and mapped indexes share one search path.
- On SIFT1M it reaches 0.96 recall@10 at 11.6K queries/s on a single thread, about 92x faster than brute force, and 0.998 recall at higher search effort.