oracletrace icon indicating copy to clipboard operation
oracletrace copied to clipboard

[Feature]: Add a `--only-regressions` flag

Open KaykCaputo opened this issue 7 months ago • 3 comments

Summary

Add a --only-regressions flag to filter diff output and display only functions whose performance has worsened between runs.

Problem

Current diff output includes both regressions and improvements, which introduces noise when the primary goal is to identify performance degradations. In real workflows—especially in CI or debugging regressions—developers typically care only about what got slower, not what improved.

Proposed Solution

Introduce a CLI flag:

oracletrace main.py --json new.json --compare base.json --only-regressions

Behavior:

  • Filter out any functions where:
    • execution time decreased
    • no significant change occurred
  • Only include functions where:
    • new_time > base_time
  • Maintain existing sorting and formatting logic
  • Ensure compatibility with other flags (e.g., --top, --sort)

Use Case

  • Quickly identify performance regressions after a code change
  • Reduce noise during manual analysis
  • Integrate into CI pipelines where only regressions should be evaluated or surfaced
  • Combine with --fail-on-regression for automated checks

Example (optional)

oracletrace main.py --json new.json --compare base.json --only-regressions
▲ foo()  +120ms (+30%)
▲ bar()  +45ms (+12%)

Total regressions: 2

Alternatives Considered

  • Adding a filter threshold (e.g., --min-delta) → Useful but does not replace the need to isolate regressions

Additional Context

  • Can be extended in the future with thresholds (e.g., only regressions above X%)
  • Minimal implementation: simple filter step before rendering output

Checklist

  • [x] I searched existing issues before opening this request
  • [x] I described the problem and why this feature is useful
  • [x] I provided enough detail for implementation discussion

KaykCaputo avatar Apr 08 '26 13:04 KaykCaputo

Filter out any functions where:

execution time decreased
no significant change occurred

Only include functions where:

new_time > base_time

Maintain existing sorting and formatting logic Ensure compatibility with other flags (e.g., --top, --sort)

Why isn't this default behavior?

waldo121 avatar Apr 14 '26 15:04 waldo121

Why isn't this default behavior?

I think its makes sense for regression analysis, but not as the default behavior.

The current approach is neutral and shows both improvements and regressions. Filtering by new_time > base_time by default introduces bias and may hide useful information, like expected optimizations or stable functions worth reviewing.

Keeping the current default and adding a --only-regressions flag is more predictable and flexible, while staying consistent with existing options like --top and --sort.

KaykCaputo avatar Apr 14 '26 19:04 KaykCaputo

Alright, I'll do this

waldo121 avatar Apr 15 '26 14:04 waldo121