test: add Criterion bench suite for PPE hot-path costs - #35
test: add Criterion bench suite for PPE hot-path costs#35abdallahsamabd wants to merge 1 commit into
Conversation
praxis-bot
left a comment
There was a problem hiding this comment.
Criterion Bench Suite for PPE Hot Path
PR adds an ppe-benches crate covering plugin dispatch, full-decision latency, throughput, per-PDP cost, and memory/session-taint growth. Suite design is solid: setup runs outside timed loops, fixtures mirror production wiring, CI compiles the suite via clippy --all-targets without wall-clock gating, and docs/benchmarks.md records the decision rationale and baseline numbers.
Findings
| # | Severity | File | Issue |
|---|---|---|---|
| 1 | Large | benches/memory.rs:77 |
session_append_one accumulates state across Criterion iterations |
| 2 | Medium | benches/pdp_cost.rs:98 |
PDP evaluate results not checked for expected decision outcome |
a1307c7 to
53499e9
Compare
araujof
left a comment
There was a problem hiding this comment.
Thanks for this PR!
The suite builds and its smoke tests pass. A few notes to address missing measurements and some other nits:
- Criterion does not report p95 or p99 by default. The docs only record means, so the requested p50/p95/p99 results are not covered.
- No CPU profile was captured; the document gives an expected flamegraph instead.
session_append_onekeeps adding labels to the same store, so the 8/64/512 starting sizes are quickly swamped. It also reportsn_labelselements per iteration even though only one label is appended.- The memory results do not show per-decision allocation or footprint growth with policy size.
Please address these before merging.
|
Hi @abdallahsamabd, Thank you for the contribution. Here is my review on this PR: Finding 1:
|
terylt
left a comment
There was a problem hiding this comment.
Overall, nice work! See my comments in the previous message for suggested changes.
53499e9 to
cbe45d7
Compare
Signed-off-by: Abdallah Samara <abdallahsamabd@gmail.com>
cbe45d7 to
16389c5
Compare
|
@abdallahsamabd please tag us when this one is ready for re-review. Thanks! |
|
@araujof |
Summary
Adds a Criterion benchmark suite for the Praxis Policy Engine hot path (#19).
ppe-benchesunderbenches/covering:plugin_only/cedar_only/plugin_then_cedarmode: concurrentevaluateonlydhat-heapprofilemake benchruns the suite on demand (not part ofmake ci)docs/benchmarks.mdSetup (YAML load, Cedar compile) stays outside Criterion iters so timings reflect
PolicyEngine::invoke_named/PdpResolver::evaluate/SessionStore, not load cost.CI policy: do not gate PRs on wall-clock benches. Clippy/
make cistill compile all[[bench]]targets so the suite cannot bitrot.Test plan
cargo bench -p ppe-benches --no-runcargo bench -p ppe-benches -- --testcargo clippy -p ppe-benches --all-targets -- -D warningsmake bench(or targeted:--bench full_decision,--bench pdp_cost)cargo bench -p ppe-benches --features dhat-heap --bench memorydocs/benchmarks.mdmatches local hardware / re-run if publishing release numbers