[Feature]: Add a `--only-regressions` flag
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-regressionfor 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
Filter out any functions where:
execution time decreased no significant change occurredOnly include functions where:
new_time > base_timeMaintain existing sorting and formatting logic Ensure compatibility with other flags (e.g., --top, --sort)
Why isn't this default behavior?
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.
Alright, I'll do this