A Python profiler to help you optimize your code – make it faster
pyinstrument
Pyinstrument is a Python profiler. A profiler is a tool to help you optimize your code – make it faster. To get the biggest speed increase you should focus on the slowest part of your program. Pyinstrument helps you find it!
Installation
pip install pyinstrument
Pyinstrument supports Python 3.7+.
To run Pyinstrument from a git checkout, there’s a build step.
Take a look at Contributing for more info.
Documentation
To learn how to use pyinstrument, or to check the reference, head to the
documentation.
Known issues
- Profiling code inside a Docker container can cause some strange results,
because the gettimeofday syscall that pyinstrument uses is slow in that
environment. See #83 - When using
pyinstrument script.py
wherescript.py
contains a