[Numpy-discussion] fast putmask implementation

Eric Firing efiring at hawaii.edu
Thu Aug 16 22:39:02 EDT 2007


David Cournapeau wrote:
> 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
> matlab.
> 
>> 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.

Agreed.  This is because my editor deletes spurious whitespace that was 
already in the file.  If I ruled the world, the spurious whitespace and 
hard tabs would never be there in the first place. (If I were younger I 
might use smileys in places like this, but they just don't come 
naturally to me.) As far as I can see there is no way of using svn diff 
to deal with this automatically, so in the attached revision I have 
manually removed chunks resulting solely from whitespace.  Some of the 
remaining chunks unfortunately have a mixture of whitespace and 
substantive differences.  And manually removing chunks is risky.

Is there a better way to handle this problem?  A better way to make 
diffs?  Or any possibility of routinely cleaning the junk out of the svn 
source files?  (Yes, I know--what is junk to me probably results from 
what others consider good behavior of the editor.)

Eric

> 
> cheers,
> 
> David
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: numpy_putmask.diff
Type: text/x-patch
Size: 8716 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070816/712f5b9f/attachment.bin>


More information about the NumPy-Discussion mailing list