Skip to content

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

Operationp50p95
Insert one vector (10k inserts)833 ns1.75 µs
build_index() (single run)87.09 msn/a
Get vector (random)166 ns334 ns
Search191.83 µs269.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.

AlgorithmBuildSearch p50Search p95Recall@10
IVF1.33 s653.58 µs901.96 µs1.000
IVF-PQ5.06 s227.71 µs286.42 µs0.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:

Shell
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-output

A Python version lives at ray-rs/python/benchmarks/benchmark_vector.py; its results are not published.