Skip to content

Benchmarks

Cross-language

Bindings performance comparison

Rust and Python run the same graph benchmark, so their numbers compare directly. The TypeScript benchmark measures the fluent API against the low-level API on a smaller graph.

Rust and Python

p50 latency from the single-file raw benchmark on the same 10k nodes, 50k edges graph, MVCC on.

OperationRust p50Python p50
Key lookup (random existing key)42 ns125 ns
1-hop traversal (out, random node)42 ns250 ns
Edge exists (random pair)42 ns125 ns
Batch write (100 nodes)17.92 µs24.71 µs
Batch write (100 edges)16.08 µs18.25 µs
Batch write (100 edges + props)65.50 µs201.83 µs
Get vector (random)83 ns708 ns
Has vector (random)42 ns125 ns
Set vectors (batch of 100)67.96 µs105.46 µs

Source: 2026-10-03-r2-single-file-raw-rust-mvcc-normal.txt, 2026-10-03-r2-single-file-raw-python-mvcc-normal.txt (10k nodes, 50k edges, 3 edge types, 10 edge props, 1k vectors of 128 dims, sync=normal, MVCC on)

TypeScript: fluent vs low-level API

What the fluent API (db.get, db.from().out()) costs over the low-level calls it wraps, measured in Node. This run uses a smaller graph (1k nodes, 5k edges), so compare its rows with each other, not with the Rust and Python table.

OperationLow-level p50Fluent p50Overhead
Insert (single node + props)5.50 µs6.79 µs1.23x
Key lookup (get, with props)167 ns1.33 µs7.98x
Key lookup (getRef, no props)166 ns584 ns3.52x
Key lookup (getId, id only)166 ns292 ns1.76x
1-hop traversal (count)709 ns1.13 µs1.59x
1-hop traversal (node ids)750 ns1.33 µs1.78x
1-hop traversal (toArray, with props)750 ns3.42 µs4.56x
Pathfinding BFS (max depth 5)3.46 µs2.88 µs0.83x

Source: 2026-10-03-r2-bench-fluent-vs-lowlevel-mvcc-normal.txt (1k nodes, 5k edges, 3 edge types, 10 edge props, 1k iterations, sync=normal, MVCC on, Node 24.21.0)

Vector index numbers are on the vector benchmarks page.

Running benchmarks

Commands from docs/BENCHMARKS.md, run from the repository root. Rust core:

Shell
cd ray-rscargo run --release --example single_file_raw_bench --no-default-features -- \  --nodes 10000 --edges 50000 --iterations 10000 \  --wal-size 268435456 --no-auto-checkpoint --seed 42 --sync-mode normal --mvcc

Python bindings:

Shell
cd ray-rs/python/benchmarkspython3 benchmark_single_file_raw.py \  --nodes 10000 --edges 50000 --iterations 10000 \  --wal-size 268435456 --no-auto-checkpoint --seed 42 --sync-mode normal --mvcc

TypeScript, fluent vs low-level API:

Shell
cd ray-rsnode --import @oxc-node/core/register benchmark/bench-fluent-vs-lowlevel.ts --mvcc --seed 42