Detect performance regressions between runs of your Python script in seconds.
![]() |
Fail your CI when performance regresses. OracleTrace is a git diff for performance. Run your script twice and instantly see what got slower — with function-level precision. |
Documentation: https://kaykcaputo.github.io/oracletrace/
Featured in: PyCoder's Weekly #729 • awesome-debugger • awesome-profiling
pip install oracletraceoracletrace app.pyoracletrace app.py --json baseline.json
oracletrace app.py --json new.json --compare baseline.jsonSee exactly which functions got slower between runs:
Starting application...
Iteration 1:
> Processing data...
> Calculating results...
Iteration 2:
> Processing data...
> Calculating results...
Application finished.
Summary:
Top functions by Total Time
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Function ┃ Total Time (s) ┃ Calls ┃ Avg. Time/Call (ms) ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ my_app.py:main │ 0.6025 │ 1 │ 602.510 │
│ my_app.py:process_data │ 0.6021 │ 2 │ 301.050 │
│ my_app.py:calculate_results │ 0.4015 │ 2 │ 200.750 │
└──────────────────────────────┴────────────────┴───────┴─────────────────────┘
Logic Flow:
<module>
└── my_app.py:main (1x, 0.6025s)
└── my_app.py:process_data (2x, 0.6021s)
└── my_app.py:calculate_results (2x, 0.4015s)
Performance regressions are hard to detect early.
OracleTrace compares execution traces and highlights what got slower.
- Run your script
- Generate a trace
- Compare results
- Identify slowdowns
Fail your pipeline when performance degrades:
oracletrace app.py --json current.json --compare baseline.json --fail-on-regression --threshold 25Add it to your CI to automatically fail on performance regressions.
- Detect slower and faster functions
- Identify new or removed functions
- Execution time and call count analysis
- Call graph visualization
- JSON and CSV export
- Regex-based filtering (
--ignore) - Top-N function focus (
--top) - CI regression gates
| Flag | Description |
|---|---|
--json |
Export trace to JSON |
--csv |
Export trace to CSV |
--compare |
Compare with another trace |
--fail-on-regression |
Exit with error if regression detected |
--threshold |
Regression percentage threshold |
--ignore |
Ignore functions/files via regex |
--top |
Show top N functions |
- Detect performance regressions between runs
- CI performance validation
- Execution trace inspection
- Call graph visualization
OracleTrace uses Python’s sys.setprofile() to intercept function calls and returns.
It measures execution time per function and records caller–callee relationships.
Filtering removes external/internal calls to focus on application code.
- Python >= 3.10
- rich
Contributions are welcome.
Please read the Contributing Guide for details on how to get started, coding standards, and the contribution process.
If OracleTrace is useful, consider giving it a star:

