DC.DrawLInes insanely slow...

Hi folks,

I’m testing a wxPython build, and happened to run an old sampel of mine that calls DC.DrawLines.

It was running so slow that I spent way too much time debuging an apparent lack of the app starting – it turns out it was starting, it was just taking SO long to daw that it didn’t appear to be.

So: DC.Draawlines is taking about 9 seconds! to drasw 1000 line segments. If I loop through the list and call DC.DrawLine, it does it in 0.03 seconds – that is a pretty HUGE difference!

the speed difference for say, ten lines is about a factor of two, so it looksl ike it’s O(n^2) behaviour or something.

Enclosed is a small sample app – please run and check the console for print statement output and see if this is a platform or version specific thing…

wxPython 3.0.2.0

OS-X 10.8

64 bit Python 2.7.10

Cocoa wxPython build (build myself from source, with the build script)

Thanks,

-Chris

DrawLinesTest.py (2.84 KB)

···

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

Hi folks,

I'm testing a wxPython build, and happened to run an old sampel of mine that calls DC.DrawLines.

It was running so slow that I spent way too much time debuging an apparent lack of the app starting -- it turns out it was starting, it was just taking SO long to daw that it didn't appear to be.

So: DC.Draawlines is taking about 9 seconds! to drasw 1000 line segments. If I loop through the list and call DC.DrawLine, it does it in 0.03 seconds -- that is a pretty HUGE difference!

the speed difference for say, ten lines is about a factor of two, so it looksl ike it's O(n^2) behaviour or something.

Enclosed is a small sample app -- please run and check the console for print statement output and see if this is a platform or version specific thing...

wxPython 3.0.2.0
OS-X 10.8
64 bit Python 2.7.10
Cocoa wxPython build (build myself from source, with the build script)

Thanks,

-Chris

Hi Chris,

Looks an OS X issue. Using prebuilt wx binaries, here's what I got:

Windows 7
Python 2.7.10
wxPython 3.0.2.0 (32-bit)

DrawLines Call took 0.104016 seconds
DrawLine loop took 0.027976 seconds
DrawPointList Call took 0.021997 seconds

OS X 10.7.5
Python 2.7.10
wxPython 3.0.2.0 (32-bit)

DrawLines Call took 7.876068seconds
DrawLine loop took 0.054907 seconds
DrawPointList Call took 0.008379 seconds

Ubuntu 14.04
Python 2.7.6
wxPython 2.8.12.1 (Yeah, I don't keep my Linux box fully up to date.)

DrawLines Call took 0.104016 seconds
DrawLine loop took 0.027976 seconds
DrawPointList Call took 0.021997 seconds

David

So: DC.Draawlines is taking about 9 seconds! to drasw 1000 line segments.

If I loop through the list and call DC.DrawLine, it does it in 0.03 seconds
-- that is a pretty HUGE difference!

Looks an OS X issue. Using prebuilt wx binaries, here's what I got:

great, thanks!

Windows 7
Python 2.7.10
wxPython 3.0.2.0 (32-bit)

DrawLines Call took 0.104016 seconds
DrawLine loop took 0.027976 seconds

Interesting, though -- DrawLines is still 4-5 time slower than loping
through and calling DrawLine -- which makes littel sense -- that's a lot of
python call overhead!

OS X 10.7.5
Python 2.7.10
wxPython 3.0.2.0 (32-bit)

DrawLines Call took 7.876068seconds
DrawLine loop took 0.054907 seconds
DrawPointList Call took 0.008379 seconds

yup really bad -- is this Carbon or Cocoa build"? mine is Cocoa.

Looks like this is something in the C++ though, as that would be more
different on the different platforms.

Ubuntu 14.04

Python 2.7.6
wxPython 2.8.12.1 (Yeah, I don't keep my Linux box fully up to date.)

DrawLines Call took 0.104016 seconds
DrawLine loop took 0.027976 seconds

still that 4 times as much thing -- but tolerable.

Thanks for the confirming tests.

-Chris

···

On Wed, Jun 10, 2015 at 11:39 AM, David Woods <transana@gmail.com> wrote:

--

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

Mine is Carbon.

My pleasure.  Best of luck getting this sorted out.

David
···

On Wed, Jun 10, 2015 at 11:39 AM,
David Woods transana@gmail.com
wrote:

              So:

DC.Draawlines is taking about 9 seconds! to drasw 1000
line segments. If I loop through the list and call
DC.DrawLine, it does it in 0.03 seconds – that is a
pretty HUGE difference!

          Looks an OS X issue.  Using prebuilt wx binaries, here's

what I got:

great, thanks!

Windows 7

          Python 2.7.10

          wxPython 3.0.2.0 (32-bit)



          DrawLines Call took 0.104016 seconds

          DrawLine loop took 0.027976 seconds
          Interesting, though -- DrawLines is still 4-5 time

slower than loping through and calling DrawLine – which
makes littel sense – that’s a lot of python call
overhead!

OS X 10.7.5

          Python 2.7.10

          wxPython 3.0.2.0 (32-bit)



          DrawLines Call took 7.876068seconds

          DrawLine loop took 0.054907 seconds

          DrawPointList Call took 0.008379 seconds
          yup really bad -- is this Carbon or Cocoa build"? mine

is Cocoa.

          Looks like this is something in the C++ though, as that

would be more different on the different platforms.

Ubuntu 14.04

          Python 2.7.6

          wxPython 2.8.12.1  (Yeah, I don't keep my Linux box fully

up to date.)

          DrawLines Call took 0.104016 seconds

          DrawLine loop took 0.027976 seconds

still that 4 times as much thing – but tolerable.

Thanks for the confirming tests.

Mine is Carbon.

Interesting – so same issue on Carbon and Cocoa…

-Chris

···

Looks like this is something in the C++ though, as that
would be more different on the different platforms.

Ubuntu 14.04

          Python 2.7.6

          wxPython 2.8.12.1  (Yeah, I don't keep my Linux box fully

up to date.)

          DrawLines Call took 0.104016 seconds

          DrawLine loop took 0.027976 seconds

still that 4 times as much thing – but tolerable.

Thanks for the confirming tests.