Profilers for Python
VizTracer
VizTracer is a simple Python package for timeline profiling. It’s profiling output can be visualised in a web browser with it’s sub-package VizViewer.
Read MorecProfile
cProfile
is a function-level profiler that is part of Python’s standard library. It is a command-line profiler, that can also be called directly from Python. 3rd party packages such as snakeviz
can be used to visualise it’s output in a web browser or Jupyter Notebook.
line_profiler
line_profiler
is a Python package for line-level profiling. It is a command-line profiler, that can also be used within Jupyter Notebooks. Functions marked with the @profile
decorator are profiled when line_profiler
is enabled during execution.
Intel VTune
Intel VTune Profiler is a fully-featured profiler that supports a broad range of languages. Users wishing to perform function or line level profiling can use the default “Hotspots” configuration, that will output profiling results in an interactive GUI with several visualisation options to aide interpretation of CPU time within the profiled application.
There are also many more advanced profiling configurations available, covering memory and hardware metrics, these are unlikely to be useful for the typical programmer.
Read MoreScalene
Scalene is a modern Python profiler that supports a wide range of profiling styles. It provides both a command line interface and a web-based GUI for visualising results. Unlike many other Python profilers it uses a sampling approach to minimise the profiling overhead, making it suitable for profiling expensive use-cases. It has support for AI powered optimisation suggestions, however this requires running a local LLM or having an API key for a cloud LLM platform.
Read More