Since you committed my fast putmask patch many months ago, I thought you
might like to deal with my fast take patch. Attached is the diff
relative to 5043, ignoring whitespace. (Yes, those pesky whitespace
anomalies are still cropping up.)
The motivation for the patch is that in matplotlib color mapping, such
as when displaying an image or pcolor plot, the time-limiting factor can
be a single numpy operation of indexing into the color map.
It was being done with fancy indexing. I changed that to use the take
method, which sped it up by a factor of two, but I found that take
itself is slower than it needs to be by a factor of 2-3. As with
putmask, the culprit is memmove, so I used the same strategy to
substitute direct variable assignment when possible.
The patch includes tests for the take method. I did not find any such
Thanks for taking a look. Let me know what needs to be changed.