jemnotesversion 2 / featuring this entry or see all/search

Aug 11
Run a Python script through a profiler, then interpret the output. I don’t think it’s worth the bother going through iPython; I couldn’t get %run -p to work properly.
At the shell:
> python -m cProfile -o outprof.tmp examples/bb30.py
Then, in iPython:
>>> import pstats
>>> p = pstats.Stats('outprof.tmp')
>>> p.strip_dirs().sort_stats('cumulative').print_stats(50)