Benchmarks

June 15, 2026 · View on GitHub

Evidence Status

This repository carries reproducible local daemon baselines and gate fixtures. Any benchmark number used in trust, release, or marketing material must name:

  • corpus or workload name
  • commit_sha
  • run ID or artifact path
  • lane flags / feature flags
  • hardware class and operating system
  • pass/fail threshold when the number is used as a gate

The LongMemEval-style hosted retrieval result mentioned in the README is an internal preliminary CoreCrux/AMR result, not a bare local-daemon claim. Treat it as unpublished until a public evidence pack with corpus, run ID, lane flags, and commit SHA is available.

Criterion Benchmarks

The corecrux-retrieval crate includes a Criterion benchmark for BM25 scoring:

cargo bench -p corecrux-retrieval --bench bm25_bench

Results are written to target/criterion/ with HTML reports.

Latest Local Results

Measured on the development host (WSL2, Linux 5.15). Times are wall-clock per iteration (lower is better). These historical figures should be refreshed and recorded with a commit_sha before being used as current release evidence.

Corpus sizeMedian95 % CI
100 docs583 ns[581 ns, 586 ns]
1,000 docs2.62 us[2.62 us, 2.65 us]
10,000 docs23.1 us[23.1 us, 23.8 us]

BM25 Multi-Segment Scoring (bm25_score_multi)

SegmentsMedian95 % CI
28.75 us[8.74 us, 8.77 us]
423.5 us[23.1 us, 23.5 us]
872.2 us[72.0 us, 72.4 us]

Scaling is roughly linear with segment count (2x segments ~ 2.7x time), confirming no contention overhead in the multi-reader merge path.

Performance Regression Gates

The tests/bench/ directory contains JSON gate files used by CI to detect performance regressions:

tests/bench/
  perf_regression_gates/    # Startup and append latency baselines
  replay_gates/             # Deterministic replay throughput baselines
  replay_many_gates/        # Multi-stream replay baselines

Each directory contains:

  • baseline_*.json — The accepted performance baseline (established by a known-good build)
  • candidate_*_pass.json — A candidate result that meets the gate threshold
  • candidate_*_fail.json — A candidate result that fails the gate (used for gate validation)

Gate Thresholds

Perf Regression Gates (baseline_startupfix_v3)

Append:

MetricBaselineThreshold
Throughput25,422 events/secMin 85 % of baseline
p95 latency9.98 msMax 125 % of baseline
Fence wait (avg)1.7 msMax 135 % of baseline
Lane wait (avg)5.0 msMax 135 % of baseline
Store lock wait (avg)3.9 msMax 135 % of baseline, abs max 0.5 ms

Replay (3 workload profiles):

ProfileThroughput (reads/sec)p95 (ms)Min throughput ratioMax p95 ratio
A21,3280.520.851.25
B15,3760.740.801.35
C19,7500.570.851.25

All replay profiles require eventsReadRatio >= 0.98 and sessionUseFrames = false.

Replay Gates (baseline_append)

MetricBaseline
Total events600,000
Batches10,000
p50 latency3.4 ms
p95 latency9.1 ms
Throughput10,000 events/sec

Replay-Many Gates (multi-stream baselines)

ProfileThroughput (reads/sec)p95 (ms)Avg reads/RPC
A3,2003.48.0
B85012.08.0
C2,9004.28.0

Gate File Format

{
  "metric": "append_p99_ms",
  "baseline": 2.1,
  "candidate": 2.3,
  "threshold_pct": 15.0,
  "pass": true
}

A candidate passes if (candidate - baseline) / baseline * 100 <= threshold_pct.

Running Benchmarks Locally

# BM25 scoring benchmark (Criterion)
cargo bench -p corecrux-retrieval --bench bm25_bench

# Replay benchmark (requires a data directory with sealed segments)
CORECRUXD_DATA_DIR=./data cargo run --release --bin corecruxctl -- replay --scope full

# Verify-store integrity benchmark
CORECRUXD_DATA_DIR=./data cargo run --release --bin corecruxctl -- verify-store --scope all --mode full --strict

Adding a New Benchmark

  1. For micro-benchmarks: Add a [[bench]] entry to the relevant crate's Cargo.toml and create a Criterion benchmark file in benches/.
  2. For regression gates: Add baseline + candidate JSON files to the appropriate tests/bench/ subdirectory.