Python Profiler Overview ¶
Published 2023-05-25; Updated 2024-12-01
The following table gives an overview across many popular and actively maintained Python profilers and their capabilities:
Profiler | Time | Mem | Viz | Type | Other |
---|---|---|---|---|---|
cProfile | - | - | instrumenting | Viz via SnakeViz or Tuna | |
py-spy | - | sampling | |||
memray | - | instrumenting | |||
Scalene | sampling | also GPU time | |||
Austin | sampling | can also be used with pprof | |||
pyinstrument | - | sampling | |||
Linux perf | - | - | sampling | needs Python 3.12+ | |
line_profiler | - | - | instrumenting | ||
Fil | - | instrumenting | |||
Guppy3 | - | - | instrumenting | ||
Yappi | - | - | instrumenting | ||
Palanteer | instrumenting | also supports C++ | |||
vprof | sampling | ||||
VizTracer | - | instrumenting | |||
gprofiler | - | sampling | supports also native & Java programs and kernel routines | ||
OTel eBPF Profiler | - | sampling | local viz via devfiler, integration with OTel | ||
pyroscope-io | - | sampling | client for pyroscope platform | ||
sciagraph | sampling | proprietary | |||
akarsu | - | - | - | instrumenting | counts events via sys.monitoring , needs Python 3.12+ |
Others
- Pyroscope is a continuous profiling platform with Python support, including an (e)BPF profiler (based on bcc pyperf).
- bcc pyperf is a sampling time profiler based on (e)BPF, seems to support Python 3.6 only.
- Memory Profiler is a sampling memory profiler, but not actively maintained anymore.
- Pyflame, an archived sampling time profiler.
Post Updates
2024-12-01: Added Linux perf, OTel eBPF Profiler, akarsu, gprofiler and bcc pyperf
2024-12-01: Updated Pyroscope details, adding link to their eBPF profiler