proposal: benchmark harness vs OPA / Cedar#8
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR establishes a latency benchmark harness for zopa.wasm: design proposal, JSON fixtures, a Node.js runner that measures percentile latencies, build/CI integration, and user-facing README with run instructions. ChangesBenchmark Harness
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
New 'zig build bench' target runs bench/run.mjs against the freshly built zopa.wasm. Reports p50/p95/p99/mean in microseconds across each fixture in bench/fixtures/. Two starter fixtures: 01_static (literal allow:true) and 02_header_eq (input.method == 'GET'). Each fixture also carries the equivalent rego/cedar source for cross-engine runs added later. Cross-engine comparison (OPA WASM SDK, OPA HTTP, Cedar) is deferred per docs/proposals/benchmark-harness.md until the OPA conformance harness lands; without 'same answer' assertions a head-to-head latency number isn't honest. Sample numbers from a local M-series Mac, --release=small: 01_static p50 1.54us p99 3.46us 02_header_eq p50 4.42us p99 5.17us
- test-unit: runs 'zig build test-unit' so host-side Zig unit tests are exercised in CI (matches feat/string-builtins and feat/composite-ref-iteration). - bench: runs 'zig build bench' (Node-driven, ~22000 evaluations total over 2 fixtures) and prints the latency table to the run log. Not gated; the goal is visibility, not perf-regression enforcement (CI runners have variable noise floors).
3d1f406 to
d7b933c
Compare
- bench/fixtures/02_header_eq.json: rewrite Cedar policy from 'action == Action::"GET"' (matches an action named GET) to 'action when context.method == "GET"' (checks the request context method attribute, matching the Rego/AST semantics). Cosmetic for now since cross-engine bench is deferred. - bench/run.mjs: validate evaluate() return value during warmup; -1 (parse / depth-cap / unknown-node failures) now raises so the benchmark never times an error path. The hot ITERS loop stays branch-free since warmup already certified the fixture. - bench/run.mjs: comment block above the proxy stub env explaining the stubs always succeed and would mask errors if reached, plus the harness-drift check. - .github/workflows/ci.yml: drop 'needs: build' from bench job. 'zig build bench' rebuilds via the install step anyway, so the job dep adds wait time without saving work. Skipped (false positive): bench/README.md reference to docs/proposals/opa-conformance-harness.md is intentional. Cross-engine bench depends on conformance landing first; the link points to the right proposal.
Design doc only. Tracks the compiled-policy benchmark item from ROADMAP near term.
See
docs/proposals/benchmark-harness.md.Summary:
Status: design only, no implementation.
Summary by CodeRabbit
New Features
Documentation
Chores