[Numpy-discussion] fast putmask implementation

David Cournapeau cournape at gmail.com
Thu Aug 16 22:05:15 EDT 2007

On 8/17/07, Eric Firing <efiring at hawaii.edu> wrote:
> In looking at maskedarray performance, I found that the filled()
> function or method is a bottleneck.  I think it can be sped up by using
> putmask instead of indexed assignment, but I found that putmask itself
> is slower than it needs to be.  So I followed David Cournapeau's example
> of fastclip and made a similar fastputmask.  The diff relative to
> current svn (3967) is attached.

Great ! putmask was actually the function I wanted to improve after
clip, because it is the second bottleneck for matplotlib imagesc :) I
would not be suprised if now imagesc has descent speed compared to

> I hope someone will take a look and either tell me what I need to fix or
> commit it as-is.

It looks like there are a lot of spurious diff in you patch (space vs
tab, or endline problems ?). Could you regenerate a patch without
them, since half of the patch is "garbage" ? It would be much easier
to see the changes you actually made.



More information about the NumPy-Discussion mailing list