Skip to main content

Module batch_distance

Module batch_distance 

Source
Expand description

Batch distance computation for HNSW neighbor selection.

Instead of computing distances one-at-a-time in a loop, collects candidate vectors and computes distances in bulk. This improves cache utilization and enables SIMD-friendly memory access patterns.

Used by select_neighbors_heuristic in build.rs to accelerate the diversity check during HNSW graph construction.

Functionsยง

batch_distances
Compute distances from a query vector to multiple candidate vectors.
is_diverse_batched
Precompute all pairwise distances between selected neighbors and a candidate.