Draw method in PlotCanvas class for a number of points (>80, 000) takes too much time

Christopher Barker <Chris.Barker <at> noaa.gov> writes:

>
> Christian Kristukat wrote:
>
> > I just checked that using PlotCanvas with numpy on a Celeron 2.8GHz, plotting
> > a
> > 100000 pts line takes 1.1 seconds. This seems reasonably fast.
>
> that's probably about as good as it gets, until we add the ability for
> wxPython to directly read the data in numpy arrays.

Do you really think a DC implementation that can handle ndarrays will make the
difference? What about the drawing itself? If the conversion ndarray->list is
really the bottleneck then this is one more argument to support Travi's quest on
getting a ndarray object into python.

···

---

You know, finding a bottleneck and improving speed can be quite
a complicate task.

Take the numpy package for exemple. For my calculations, I wrote all
the basic linear algebra stuff, matrix/vector definition, GaussJordan,
LU-decomposition... in pure Python. If I attempt to compare the speed
of my modules with numpy, one get sometimes good suprises.

Inverting 1000 times a 3x3 matrix with my module: 0.48 second
Inverting 1000 times a 3x3 matrix with numpy: 0.46 second

I will not attempt to generalize, depending on the test operations the
difference between "pure Python" modules and numpy vary broadly. Sometimes
"pure Python" wins, sometimes numpy wins.

Jean-Michel Fauth, Switzerland

jmf wrote:

You know, finding a bottleneck and improving speed can be quite
a complicate task.

It sure can. Add that I mostly use Linux, and X-windows is asynchronous -- it's really a trick!

If I attempt to compare the speed
of my modules with numpy, one get sometimes good suprises.

Inverting 1000 times a 3x3 matrix with my module: 0.48 second
Inverting 1000 times a 3x3 matrix with numpy: 0.46 second

Actually, I'm surprised that the python code isn't faster -- I bet psyco certainly would be. There is some overhead with numpy arrays, so they only help if you are working with large arrays. Try inverting a 1000X1000 matrix 3 times, and see what you get.

I will not attempt to generalize, depending on the test operations the
difference between "pure Python" modules and numpy vary broadly. Sometimes
"pure Python" wins, sometimes numpy wins.

yup, but I like numpy syntax better anyway.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov