Benchmarks
Vector benchmarks
Vector search performance
Vector index latency through the Rust API, measured with the vector_bench and vector_ann_bench examples on October 3, 2026 (Apple M5 Pro).
Test configuration
- Vectors: 10,000 random vectors of 768 dimensions
- Metric: cosine
- Index: IVF with 100 clusters
- Search: k=10, nProbe=10, 1,000 iterations
Results
| Operation | p50 | p95 |
|---|---|---|
| Insert one vector (10k inserts) | 833 ns | 1.75 µs |
| build_index() (single run) | 87.09 ms | n/a |
| Get vector (random) | 166 ns | 334 ns |
| Search | 191.83 µs | 269.54 µs |
Source: 2026-10-03-r2-vector-bench-rust.txt (10k vectors, 768 dims, 1k iterations, k=10, nProbe=10, cosine, IVF with 100 clusters)
vector_bench uses the default ANN algorithm of VectorIndex, auto: plain IVF below 50,000 vectors or 512 dimensions, IVF-PQ from there on. At 10k vectors it builds IVF, as the log header shows.IVF and IVF-PQ
Where auto switches to IVF-PQ, at 768 dimensions and 50,000 vectors, IVF-PQ searches compact product-quantization codes, then re-ranks its best candidates by exact distance. Here its search p50 is 2.9x faster than IVF's (228 µs against 654 µs) at a recall@10 of 0.94 against 1.00, and its build takes 3.8x as long.
| Algorithm | Build | Search p50 | Search p95 | Recall@10 |
|---|---|---|---|---|
| IVF | 1.33 s | 653.58 µs | 901.96 µs | 1.000 |
| IVF-PQ | 5.06 s | 227.71 µs | 286.42 µs | 0.935 |
Source: 2026-10-03-r2-vector-ann-768d-ivf.txt, 2026-10-03-r2-vector-ann-768d-ivf-pq.txt (50k vectors of 768 dims (lowrank dataset), 200 queries, k=10, nProbe=10, 223 clusters, IVF-PQ with 48 subspaces and the default re-rank)
Running benchmarks
Command from docs/BENCHMARKS.md, run from the repository root:
cd ray-rscargo run --release --example vector_bench --no-default-features -- \ --vectors 10000 --dimensions 768 --iterations 1000 --k 10 --n-probe 10 --seed 42 --no-outputA Python version lives at ray-rs/python/benchmarks/benchmark_vector.py; its results are not published.