Operator-Use icon indicating copy to clipboard operation
Operator-Use copied to clipboard

[Phase 0.2.2] Create performance benchmark harness

Open richard-devbot opened this issue 8 months ago • 0 comments

Phase

Phase 0 — Foundations | Track 0.2 — Test Infrastructure | Priority: P1

Summary

Create tests/benchmarks/ with timing fixtures and baseline recording for performance regression testing.

What

  • Create tests/benchmarks/__init__.py
  • Create tests/benchmarks/conftest.py with:
    • benchmark_timer — context manager that records execution time
    • baseline_store — JSON file storing baseline measurements
    • regression_check — compares current vs baseline, fails if >10% regression
  • Create tests/benchmarks/baselines.json for storing recorded baselines
  • Integrate with pytest-benchmark for standardized reporting

Why

Phase 3 (Performance) requires a way to measure, record, and compare performance. Building the harness now means every optimization has proof it worked.

Acceptance Criteria

  • [ ] tests/benchmarks/ directory exists with conftest
  • [ ] pytest-benchmark added to dev dependencies
  • [ ] At least one example benchmark test runs and records a baseline
  • [ ] Regression detection works (artificially degrade, verify it flags)

References

  • pytest-benchmark
  • Design Doc: docs/plans/2026-03-29-security-ai-guardrails-performance-design.md

Blocks

All Phase 3 issues (benchmarks use this harness)

richard-devbot avatar Mar 29 '26 04:03 richard-devbot