[Numpy-discussion] Profiling numpy ? (parts written in C)
Charles R Harris
charlesr.harris at gmail.com
Tue Dec 19 08:33:37 CST 2006
On 12/19/06, Francesc Altet <faltet at carabos.com> wrote:
> A Dimarts 19 Desembre 2006 08:12, David Cournapeau escrigué:
> > Hi,
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion