Skip to content

Instantly share code, notes, and snippets.

@gerrich
Created July 10, 2015 20:31
Show Gist options
  • Save gerrich/16263a9ab4f2af3d17e4 to your computer and use it in GitHub Desktop.
Save gerrich/16263a9ab4f2af3d17e4 to your computer and use it in GitHub Desktop.
Python profile tools
#from http://thirld.com/blog/2014/11/30/visualizing-the-results-of-profiling-python-code/
pip install pyprof2calltree
#Profile your program as usual:
python -m cProfile -o prof.out mycode.py
#Then visualize the results in KCacheGrind:
pyprof2calltree -i prof.out -k
pip install pyinstrument
python -m pyinstrument mycode.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment