Context
Problem
Optimizations cannot be proven or guarded without repeatable microbenchmarks and expanded scenario coverage.
Proposed change
- Add Criterion benches (opt-in, not required in default CI) for:
match_route_compiled (static vs param route)
map_handler_return (str / bytes)
json_to_py (before/after direct conversion)
- Extend perf-test with wrk scenarios:
- plain text GET
- JSON POST body + JSON response
- JWT-protected GET
- CORS-enabled app
- route with one dependency
- Document how to run locally; optional CI smoke with threshold (low connection count).
Files
- new
benches/, Cargo.toml, perf-test/, perf-test/README.md
- optional workflow job (manual / scheduled)
Acceptance criteria
cargo bench runs selected microbenches when configured.
perf-test documents all scenarios and env vars (OXYROUTE_BENCH=1, etc.).
- README explains baseline collection before perf PRs.
Expected impact
Evidence-based perf work; regression detection for hot-path changes.
Context
perf-test/covers hello-world wrk only; optional gate intests/test_perf_hello_bench.py.benches// Criterion in the repo; backlog perf: reduce lock contention on route match (RWLock or route snapshot) #4 suggested microbenches.Problem
Optimizations cannot be proven or guarded without repeatable microbenchmarks and expanded scenario coverage.
Proposed change
match_route_compiled(static vs param route)map_handler_return(str/bytes)json_to_py(before/after direct conversion)Files
benches/,Cargo.toml,perf-test/,perf-test/README.mdAcceptance criteria
cargo benchruns selected microbenches when configured.perf-testdocuments all scenarios and env vars (OXYROUTE_BENCH=1, etc.).Expected impact
Evidence-based perf work; regression detection for hot-path changes.