[Kstars-devel] comparing elapsed time for drawing under 3.5 and 4.0

Jason Harris kstars at 30doradus.org
Mon Jun 12 01:48:04 CEST 2006


Hello,

First of all, I found a problem that was adding 0.12 seconds to the drawing 
time in 4.0: to paint the final image onto the skymap widget, I was using:

  psky.drawImage( 0, 0, sky2->toImage() ); 

where sky2 is a QPixmap* containing the newly-rendered sky.  Turns out the 
conversion to QImage takes 0.13 sec, so simply replacing that line with:

  psky.drawPixmap( 0, 0, *sky2 );

knocks off a huge chunk of time.  I'll be committing this change soon.

I discovered this while doing more detailed timing of the draw loops in both 
the 4.0 and 3.5 codebases.  Here's what the timings look like for 4.0:

 Milky Way  : 2 ms
 Coord grid : 4 ms
 Cons Bound : 6 ms
 Cons Lines : 2 ms
 Cons Names : 0 ms
 Equator     : 2 ms
 Ecliptic    : 2 ms
 Deep sky    : 10 ms
 Stars       : 11 ms
 Solar sys   : 4 ms
 Name labels : 0 ms
 Horizon     : 1 ms
 SkyMapComposite::draw() took 45 ms  <-- [total of above times]
 drawOverlays() took 1 ms
 drawImage() took 1 ms   <-- [this used to say "128 ms" before the above fix]
 Skymap draw took 47 ms  <-- this is the total time for SkyMap::paintEvent()

And here is 3.5:

 Milky Way:  1
 Coord grid: 1
 Cons Bound: 3
 Cons Lines: 0
 Cons Names: 0
 Equator:    0
 Ecliptic:   1
 Deep sky:   8
 Stars:      3
 Solar sys:  4
 Name label: 0
 Horizon:    1
 Skymap draw took 22 ms

In both cases, I had the same geolocation, map pointing, window size and zoom 
level.  

In almost all categories, the 4.0 draw function takes about twice as long as 
the 3.5 equivalent.  This could be due to the SkyComponent changes, or maybe 
a Qt4 inefficiency (just speculating).  

One exception is Stars.  In 3.5, Stars take less time than Solar system or 
Deep sky, whereas in 4.0, Stars take the most time of any category.  I think 
this may be due to the fact that I use drawEllipse() to render stars in 4.0, 
whereas in 3.5, we precached star pixmaps, which were then scaled and drawn 
to the screen with bitBlt().  I thought that drawEllipse() would surely be 
faster than scaling pixmaps for each star, but maybe I need to look again...

Jason

-- 
KStars: http://edu.kde.org/kstars
Community Forums: http://kstars.30doradus.org


More information about the Kstars-devel mailing list