[Numpy-discussion] array.min() vs. min(array)

Francesc Altet faltet at carabos.com
Thu Apr 27 07:08:06 CDT 2006

A Dijous 27 Abril 2006 15:40, Ryan Krauss va escriure:
> I think this is a great idea.  We get a lot of these kinds of
> questions on the list, and the collective wisdom of people here who
> have really dug into this is really impressive.  But, that wisdom does
> need to be a little easier to find.
> Speaking of which, I don't always feel like I get trustworthy results
> out of the profiler, so when I really want to know what is going on I
> find myself doing this alot:
> t1=time.time()
> [block of code here]
> t2=time.time()
> [more code]
> t3=time.time()
> and then comparing t3-t2 and t2-t1 to narrow down where the code is
> spending its time.
> Does anyone have good tips on how to do good profiling?  Or is this
> question so vague and counter-intuitive that I seem silly and I had
> better come back with a believable example?

Well, if you are on Linux, and want to time C extension, then oprofile
is a *very* good option. Another profiling tool is Cachegrind, part of
Valgrind. It uses the processor emulation of Valgrind to run the
executable, and catches all memory accesses for the trace. In
addition, you can combine the output of oprofile with Cachegrind.
In [3] one can see more info about these and more tools.

[1] http://oprofile.sourceforge.net
[2] http://kcachegrind.sourceforge.net/
[3] https://uimon.cern.ch/twiki/bin/view/Atlas/OptimisingCode


>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data

More information about the Numpy-discussion mailing list