What problem does it solve?
It helps you identify which parts of your Python code consume the most CPU time so you can speed up slow scripts and optimize performance with evidence.
Core Features & Use Cases
- Execution time profiling with py-spy: Capture a CPU-time profile for a target Python script.
- Speedscope visualization: Open the recorded profile in a browser-based viewer to inspect call paths and hotspots.
- CPU vs GIL time control: Use options like recording only GIL-held time for Python-level CPU profiling or include deeper native activity by adjusting flags.
Use when you need to debug performance regressions, compare versions, or confirm whether the slowness comes from Python vs extension/native work.
Quick Start
Profile your script by running the profiling environment command for pyspy with your script path, producing a speedscope JSON profile you can open afterward.