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

David Cournapeau david at ar.media.kyoto-u.ac.jp
Tue Dec 19 20:41:02 CST 2006

Charles R Harris wrote:
>     My guess is that the real bottleneck is in calling so many times
>     memmove (once per element in the array). Perhaps the algorithm can be
>     changed to do a block copy at the beginning and then modify only the
>     places on which the clip should act (kind of the same that you have
>     made in Python, but at C level).
> IIRC, doing a simple type specific assignment is faster than either 
> memmov or memcpy. If speed is really of the essence it would probably 
> be worth writing a type specific version of clip. A special function 
> combining clip with RGB conversion might do even better.
At the end, in the original context (speeding the drawing of 
spectrogram), this is the problem. Even if multiple backend/toolkits 
have obviously an impact in performances, I really don't see why a numpy 
function to convert an array to a RGB representation should be 10-20 
times slower than matlab on the same machine.

I will take into account all those helpful messages, and hopefully come 
with something for the end of the week :),



More information about the Numpy-discussion mailing list