[off topic] Re: [Numpy-discussion] numarray speed - PySequence_GetItem

Chris Barker Chris.Barker at noaa.gov
Mon Jun 28 11:02:05 CDT 2004


Sebastian Haase wrote:
> BTW, from the profiling/timing I did you can tell that wxPyPlot actually plots 
> 25000 data points in 0.1 secs - so it's _really_ fast ...

Actually, it's probably not that fast, if you are timing on 
Linux/wxGTK/X-Windows. X is asyncronous, so what you are timing is how 
long it takes your program to tell X what to draw, but it may take 
longer than that to actually draw it. However, what you are timing is 
all the stuff that is effected by numarray/Numeric.

I worked on part of the wxPython DC.DrawXXXList stuff, and I really 
wanted a Numeric native version, but Robin really didn't want an 
additional dependency. We discussed on this list a while back whether 
you could compile against Numeric, but let people run without it, and 
have it all work unless Someone actually used it. What makes that tricky 
is that the functions that test whether a PyObject is a Numeric array 
are in Numeric... but it could probably be done if you tried hard enough 
(maybe include just that function in wxPython...) The Same applies for 
numarray support.

Anyway, as it stands, wxPython DC methods are faster with Lists or 
Tuples of values than Numeric or Numarray arrays. You might try 
converting to a list with numarray.tolist() before making the DC call.

Another option is to write a few specialized DC functions that take 
numarray arrays to draw, but are not included in wxPython. I think you'd 
get it as fast as possible that way. I intend to do that some day. If 
you want to get it started, I'll help.

You could probably get a particularly nice improvement in drawing a lot 
of rectangles, as looping through a N X 4 array of coords directly would 
be much, much faster that using the Sequence API on the whole thing, and 
on each item, and checking at every step what kind of object everything is.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the Numpy-discussion mailing list