Skip to content

ci(pr-benchmarks): require an absolute delta as well as a percentage to fail - #372

Merged
Chris-Wolfgang merged 2 commits into
mainfrom
ci/pr-benchmarks-absolute-floor
Sep 26, 2026
Merged

Chris-Wolfgang merged 2 commits into
mainfrom
ci/pr-benchmarks-absolute-floor

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Summary

The PR benchmark gate was ratio-only (time > +20%, alloc > +50%). A benchmark now fails only when it breaches the percentage and moves by an absolute floor:

Floor Value Why
TIME_REGRESSION_FLOOR_NS 1000 Benchmarks span ~2.5 µs (Action_Success) to ~13 ms. Across 8 PR runs (2026-07-17 to 2026-09-17), the largest noise swing was +16.1% on Action_Success, about 400 ns. 1 µs is ~2.5× that. It only affects sub-5 µs benchmarks, because 20% of anything larger already exceeds it.
ALLOC_REGRESSION_FLOOR_BYTES 16 Allocation deltas were 0.0% / −0.1% in every run. The smallest real managed allocation is 24 B, so 16 B filters rounding without masking a new object.

It also closes a gap: a benchmark whose base allocated 0 B was never gated, because the percentage divided by zero and the row was reported as "new". A new allocation of at least 16 B on a zero-alloc path now fails. That matters for a library with ZeroAllocationTests.

The floor alone should be enough; retry-before-fail is left out. These are pure in-memory benchmarks, and the noise observed stayed under the 20% threshold.

Verification

I extracted the gate's Python and ran it locally (Python 3.12) against synthetic base/head reports:

  • +24% / +600 ns on a 2.5 µs benchmark → passes (noise)
  • +100% / +2,500 ns on the same benchmark → fails
  • +23% / +3 ms on a 13 ms benchmark → fails
  • +12 B allocation (8 → 20 B) → passes
  • 0 B → 24 B → fails

actionlint and zizmor aren't installed locally, so the workflow lint runs in CI only.

Merge note

This touches .github/workflows/, so the protected-file guard will need an admin-bypass merge.

Closes #326

🤖 Generated with Claude Code

…to fail

The gate was ratio-only, so scheduling noise on the ~2.5 us benchmark
could breach 20% by itself. A benchmark now fails only when it is over
the percentage AND moved by >= 1000 ns (time) / >= 16 B (allocations).
Floors are derived from 8 historical PR runs and documented beside the
thresholds.

Also gates a new allocation on a benchmark whose base allocated 0 B,
which the percentage path skipped (division by zero -> "new").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 26, 2026 17:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Updates the PR benchmark gate to require both percentage and absolute regression thresholds, including zero-allocation regressions.

Changes:

  • Adds documented time and allocation floors.
  • Detects regressions from zero-allocation baselines.
  • Improves regression reporting.
File Description
.github/​workflows/​pr-benchmarks.yaml Implements percentage-plus-absolute benchmark gating.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

PR benchmarks vs base (f513c6d)

Thresholds: time > +20% and ≥ +1000 ns or allocations > +50% and ≥ +16 B (or any allocation ≥ 16 B where the base allocated none) trigger a gate failure (label perf-impact-acknowledged overrides).

Benchmark Δ time Δ alloc
Action_Success +14.5% 0 (new)
Action_WithException +1.3% +0.0%
RunAsync_Action_Success -8.2% +0.1%
RunAsync_Action_WithException +8.7% -0.0%
RunAsync_Func_Success -2.9% +0.0%
RunAsync_Func_WithException -1.7% +0.0%
Run_Func_Success -0.3% +0.0%
Run_Func_WithException -2.5% +0.0%

@Chris-Wolfgang
Chris-Wolfgang merged commit 39c0057 into main Sep 26, 2026
19 checks passed
@Chris-Wolfgang
Chris-Wolfgang deleted the ci/pr-benchmarks-absolute-floor branch September 26, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PR benchmark gate is ratio-only with no absolute floor (same gap as ETL-Abstractions#367/#427)

2 participants