← Back to team overview

kicad-developers team mailing list archive

Re: Re: wxDC & wxGraphicsContext Test

 

emmedics4 wrote:
> --- In kicad-devel@xxxxxxxxxxxxxxx, Wayne Stambaugh <stambaughw@...> wrote:
>> Dick Hollenbeck wrote:
>>> Marco Serantoni wrote:
>>>> As was requested, i've done a trivial benchmark, i've taken a file from wxWin tracker and readapted to do a trivial test just to begin to taste the difference of times of the two approaches.
>>>>
>>>> The test does 100000 lines in a square of 100x100.
>>>> For the wxGC 
> 
>> See the attachments for the results I got on the same computer to
>> compare gtk/cairo performance versus msw/gdi+ performance. I modified
>> Marco's program to use a single wxGraphicsPath instead of 10 and removed
>> the grid since it was not drawn using wxDC. I thought this might be a
>> bit more sensible comparison. 
> 
> Good, but no application would use only one Path (means 1 thichness and color), using 10 changes something ?

Yes. If you look at source code for wxGraphicsContext, you will see
that wxGCDC::DrawLine() ends up creating and destroying a
wxGraphicsPath() for each line drawn. This is why your initial test saw
a large improvement on OSX. It was only using 10 paths when drawing
with wxGraphicsContext compared to 200,000 paths (indirectly) when
drawing with wxDC. See wxWidget's source file common/graphcmn.cpp. I
believe that this is what Dick was talking about when using a proper
wxGraphicsContext implementation instead of wxGCDC. There must be some
significant overhead when constantly calling the graphics context for
each line.

>> Marco's results on OSX are what I
>> expected. On OSX wxDC == wxGraphicsContext so Marco's test proves that
>> using wxGraphicsPath to do the drawing versus calling DrawLine() 200,000
>> times saves a lot overhead. 
> 
> I weren't expect that "difference" of performance on absolute time, i've an Intel GMA 950 with 64MB of shared memory.

I think the most important thing we can learn from this test is the
relative performance between using wxDC and wxGraphicsContext across
platforms. This information is useful for determining if using
wxGraphicsContext makes sense. Obviously on OSX, wxGraphicContext is
usable as it is already being used. Looking at the results of the test
on msw/gdi+, would suggest that it isn't.

> 
> Looks that overpriced and crap hw also does its work well.
> 
>> On gtk/cairo and msw/gdi+ the story is
>> different. Although there is an order of magnitude performance
>> decrease, gtk/cairo is probably usable. However, the the msw/gdi+
>> situation is bleak. I cannot see how msw/gdi+ could ever be made usable
>> for Kicad (or anything else for that matter). The msw/cairo combination
>> still needs to be investigated. I'll try to test this over the next
>> week or two when I get some free time. I may also try to modify the
>> example to use SFML if it isn't too much of a hassle to see if it lives
>> up to it's name.
> 
> Which CAIRO backend are you using and with which driver on linux ?

I'm using the AMD64 version of Debian testing (sqeeze) with the NVidia
proprietary drivers and cairo version 1.8.8.

> 
>> It's looking like Manveru was correct about GDI+ performance. It is
>> also looking like I may have wasted my time moving the coordinate
>> transforms to wxDC if we can't use wxGraphicsContext due to performance.
> 
> First test are for NO GO for me too, but better doing more deep tests before thrash all.

I don't know about that. The gtk/cairo difference of 0.04s to 0.5s can
probably be improved enough with some clever programming. I seriously
doubt that you are going to overcome the 0.124s to 17.985s difference on
msw/gdi+ with careful programming unless this test is the completely
wrong approach to using wxGraphicsContext.

Wayne

> 
> --
> Marco

 




Follow ups

References