[Numpy-discussion] Profiling numpy ? (parts written in C)

David Cournapeau david at ar.media.kyoto-u.ac.jp
Tue Dec 19 01:12:34 CST 2006


   Following the discussion on clip and other functions which *may* be 
slow in numpy, I would like to know if there is a way to easily profile 
numpy, ie functions which are written in C.
   For example, I am not sure to understand why a function like take(a, 
b) with a a double 256x4 array and b a 8000x256 int array takes almost 
200 ms on a fairly fast CPU; in the source code, I can see that numpy 
uses memmove, and I know memmove to be slower than memcpy. Is there an 
easy way to check that this is coming from memmove (case in which 
nothing much can be done to improve the situation I guess), and not from 
something else ?



More information about the Numpy-discussion mailing list