News for hackers. Stuff that matters.
Re:Profiling Python Like a Boss by shoyer on Tuesday December 03, 2013 @03:04AM (#6839192)
In my experience, the easiest way to analyze Python performance is with the %time, %timeit and %prun magic commands in IPython, an alternative Python shell that is far more powerful than the original.

With IPython, you can simply write:

  %time result = expensive_function()
and the time it takes to execute expensive_function() is printed out to the console. You can also directly substitute %timeit or %prun for %time to use loops for the timer or to invoke built-in profiler. No need to write any of your own boilerplate!

There are no comments on this comment yet.