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

Charles R Harris charlesr.harris at gmail.com
Tue Dec 19 09:33:37 EST 2006


On 12/19/06, Francesc Altet <faltet at carabos.com> wrote:
>
> A Dimarts 19 Desembre 2006 08:12, David Cournapeau escrigué:
> > Hi,
> >


<snip>




>
> 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.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20061219/07912abd/attachment.html>


More information about the NumPy-Discussion mailing list