Sometimes, there are certain lines in the code which are known to be slow and might not be the case that the developer is interested in profiling. While this could be done by pre-executing upto the line and then run pyheat only for a snippet, it is much easier if we just use a log
scale.
Profilers are extremely helpful tools. They help us dig deep into code, find and understand performance bottlenecks. But sometimes we just want to lay back, relax and still get a gist of the hot zones in our code.
A picture is worth a thousand words.
So, instead of presenting the data in tabular form, if presented as a heatmap visualization, it makes comprehending the time distribution in the given program much easier and quicker. That is exactly what is being done here !
- Simple CLI interface.
- No complicated setup.
- Heatmap visualization to view hot zones in code.
- Ability to export the heatmap as an image file.
- Ability to scroll, to help view heatmap of large py files.
pip install py-heat
git clone https://github.com/csurfer/pyheat.git
python pyheat/setup.py install
# To view the heatmap.
pyheat <path_to_python_file>
# To output the heatmap as a file.
pyheat <path_to_python_file> --out image_file.png
pyheat --help
from pyheat import PyHeat
ph = PyHeat(<file_path>)
ph.create_heatmap()
# To view the heatmap.
ph.show_heatmap()
# To output the heatmap as a file.
ph.show_heatmap('image_file.png')
Please use issue tracker for reporting bugs or feature requests.
Pull requests are most welcome.
If you found the utility helpful you can buy me a cup of coffee using