Regressions¶
Regression gating for mew compare.
A regression is a benchmark whose delta against the baseline exceeds a threshold in the slower direction.
For real_time / cpu_time larger is worse; for iterations smaller is worse.
Per-benchmark allowlist rules can ignore a benchmark or raise its threshold, matched against the full name via fnmatch.fnmatchcase().
- class mew.regressions.Verdict(*values)[source]¶
Bases:
Enum- OK = 'ok'¶
Within the active threshold; does not contribute to gate failure.
- REGRESSED = 'regressed'¶
Slower than the default threshold and not covered by any allow rule.
Causes the gate to fail (exit code 2).
- ALLOWED_OVER = 'allowed_over'¶
Over the default threshold but inside a rule-supplied threshold.
Surfaced as a soft warning for periodic review.
- IGNORED = 'ignored'¶
Out-of-scope per a matching
ignore=truerule.Listed in the panel so the allowlist stays visible.
- class mew.regressions.AllowRule(pattern, reason, ignore=False, threshold_pct=None)[source]¶
Bases:
object
- class mew.regressions.BenchmarkVerdict(name, delta_pct, verdict, rule)[source]¶
Bases:
objectPer-benchmark gating outcome carried through the compare pipeline.
- class mew.regressions.RegressionConfig(default_threshold_pct, rules=())[source]¶
Bases:
object
- mew.regressions.load_config(*, default_threshold_pct, path=None, inline_allows=None)[source]¶
Build a
RegressionConfig.Reads
[tool.mew.regressions]frompath(orpyproject.tomlin the cwd whenpathisNone). Inline--allowstrings from the CLI are appended after file rules; both lists are searched in order.- Return type:
- Parameters:
- mew.regressions.render_panel(verdicts, *, default_threshold_pct)[source]¶
Format the regression panel and compute the exit code.
- Parameters:
verdicts (
list[BenchmarkVerdict]) – One entry per gated benchmark in display order.default_threshold_pct (float)
- Return type:
- Returns:
(text, exit_code) (tuple[str, int]) – Panel body (empty if nothing to report) and the exit code.
exit_codeis 2 if any verdict isVerdict.REGRESSED, else 0.