Eric Firing wrote:
>
> There is a clip function in all three numeric packages, so a native 
> clip is being used.
>
> If numpy.clip is actually slower than your version, that sounds like a 
> problem with the implementation in numpy.  By all logic a single clip 
> function should either be the same (if it is implemented like yours) 
> or faster (if it is a single loop in C-code, as I would expect).  This 
> warrants a little more investigation before changing the mpl code.  
> The best thing would be if you could make a simple standalone numpy 
> test case profiling both versions and post the results as a question 
> to the numpy-discussion list.  Many such questions in the past have 
> resulted in big speedups in numpy.
I am much more familiar with internal numpy code than matplotlib's, so 
this is much easier for me, too :)
>
> One more thought: it is possible that the difference is because myclip 
> operates on the array in place while clip generates a new array.  If 
> this is the cause of the difference then changing your last line to 
> "return a.copy()"  probably would slow it down to the numpy clip speed 
> or slower.
It would be scary if a copy of a 8008x256 array of double took 100 ms... 
Fortunately, it does not, this does not seem to be the problem.

cheers,

David

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to