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
| Suite | What’s Measured |
|---|---|
buffers | Slab acquire/release, BufChain push, split, watermark |
config | Config read latency, Arc clone, route lookup |
filter | Dynamic chain dispatch, metadata insert/lookup |
http_codecs | HTTP parse throughput, header pool, protocol translation |
load_balancing | RR/LeastRequest/Maglev pick, table build |
observability | Counter increment, histogram record, snapshot |
resilience | Circuit breaker, token bucket, retry decision |
Performance Scorecard
| Component | Benchmark | Target | Measured | Status |
|---|---|---|---|---|
| Config | config_read | <1ns | 0.68ns | Pass |
| Buffers | slab_acquire_release | <15ns | 5.3ns | Pass |
| HTTP | parse_simple_request | <200ns | 88ns | Pass |
| HTTP | parse_10_headers | <500ns | 151ns | Pass |
| LB | round_robin/pick | <10ns | 0.73ns | Pass |
| LB | maglev/pick | <15ns | 1.41ns | Pass |
| Resilience | circuit_breaker/try_acquire | <10ns | 5.3ns | Pass |
| Observability | counter/increment | <5ns | 2.9ns | Pass |
| Filter | dynamic_chain/5_noop | <25ns | 19ns | Pass |
| Filter | metadata/lookup_hit | <10ns | 1.6ns | Pass |
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(notThreadRng) for deterministic, fast benchmarkscriterion::black_boxprevents dead code elimination