Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Benchmarks

Meridian uses Criterion for microbenchmarks, with a dedicated meridian-bench crate that mirrors core types for isolated measurement.

Running Benchmarks

# All benchmarks
cargo bench -p meridian-bench

# Specific suite
cargo bench -p meridian-bench --bench filter
cargo bench -p meridian-bench --bench http_codecs
cargo bench -p meridian-bench --bench load_balancing

Benchmark Suites

SuiteWhat’s Measured
buffersSlab acquire/release, BufChain push, split, watermark
configConfig read latency, Arc clone, route lookup
filterDynamic chain dispatch, metadata insert/lookup
http_codecsHTTP parse throughput, header pool, protocol translation
load_balancingRR/LeastRequest/Maglev pick, table build
observabilityCounter increment, histogram record, snapshot
resilienceCircuit breaker, token bucket, retry decision

Performance Scorecard

ComponentBenchmarkTargetMeasuredStatus
Configconfig_read<1ns0.68nsPass
Buffersslab_acquire_release<15ns5.3nsPass
HTTPparse_simple_request<200ns88nsPass
HTTPparse_10_headers<500ns151nsPass
LBround_robin/pick<10ns0.73nsPass
LBmaglev/pick<15ns1.41nsPass
Resiliencecircuit_breaker/try_acquire<10ns5.3nsPass
Observabilitycounter/increment<5ns2.9nsPass
Filterdynamic_chain/5_noop<25ns19nsPass
Filtermetadata/lookup_hit<10ns1.6nsPass

Overall: 21/26 targets met (81%)

Bench Crate Rules

  • The bench crate has its own reimplementations of core types — it does NOT depend on meridian-core
  • Benchmarks test realistic workloads, not trivial inputs
  • SmallRng (not ThreadRng) for deterministic, fast benchmarks
  • criterion::black_box prevents dead code elimination