[SciPy-User] "profiling" a function

David Warde-Farley dwf@cs.toronto....
Mon Nov 30 16:45:03 CST 2009


On 30-Nov-09, at 4:52 PM, Askey, Scott A Capt USAF AETC AFIT/ENY wrote:

>
> What are the tools available in Scipy for evaluating the  
> (computational) cost of a function call?
>
>
>
> In particular I am solving nonlinear systems (with fsolve) and  
> considering exact versus approximate Jacobians
> and trig functions versus their approximations.


Nothing in SciPy itself, but Python contains the cProfile module, as  
well as hotshot.

There's also Robert Kern's line_profiler:

	 http://packages.python.org/line_profiler/

which is rather handy.

If you'd just like to time things, the 'timeit' module is good, as  
well as IPython's shortcuts for it (i.e. %timeit -n 3 my_call())

David


More information about the SciPy-User mailing list