perf: criterion benchmarks for the per-connection hot path

- benches/hot_paths.rs measures RateLimiter::check, Blacklist exact/CIDR/miss
  lookups, SubnetDetector::evaluate over 256 prefixes and HTTP request-head
  validation; `cargo bench --all-features --bench hot_paths`, HTML report in
  target/criterion.
- Dev-machine medians recorded in docs/testing.md (~110 ns rate limit,
  ~70 ns exact ban lookup, ~220 ns CIDR lookup, ~2.6 us detector window,
  ~280 ns HTTP head).
- Makefile `bench` target; the bench is gated on protocol-http.
This commit is contained in:
Loki 2026-11-16 12:55:51 +01:00
parent 08b7292ac4
commit 72c1f45d62
Signed by: boba
GPG key ID: 6CDE87BC9A778D97
5 changed files with 369 additions and 7 deletions

View file

@ -80,3 +80,10 @@ libc = { version = "0.2", optional = true }
[dev-dependencies]
# `ServiceExt::oneshot` drives the axum router in integration tests.
tower = { version = "0.5", features = ["util"] }
# Micro-benchmarks of the per-connection hot path (`cargo bench --all-features`).
criterion = { version = "0.5", features = ["html_reports"] }
[[bench]]
name = "hot_paths"
harness = false
required-features = ["protocol-http"]