Feed on

as long as you’re running a version of python newer than 2.3, you can easily call the python profiler to find bottlenecks in your code:

$ python -m cProfile mycode.py

Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

One Response to “call the python profiler for python benchmarking and optimization”

  1. [...] profiling running time in python is straightforward.  what’s tricky is measuring how much memory your program is consuming.  i’ve modified some code i found online to do the trick nicely; just import this PyVM module and insert the following into your program: import PyVM [...]

Did I get this wrong? Let me know!

Trackback URI | Comments RSS