[Qt-jambi-interest] QPixmap erratic performance

Gunnar Sletta gunnar at trolltech.com
Mon Nov 17 09:07:03 CET 2008


Bart van Deenen wrote:
> Hi all
> 
> I'm constructing a display from a nested tree of objects, each of which
> contains two QPixmaps for visual effects stuff. The whole code works 
> fine (as
> far as display content is concerned), but the performance is very erratic.
> One function that contains two consecutive drawPixmap calls on the same
> QPainter might take between 4 and 100 ms.
> I've read somewhere on the web about a maximum QPixmap storage (can't find
> where anymore). Is this what I'm running against? Is the operating system
> (Linux in my case) or the graphics driver doing something? I don't think 
> it's
> 
> my code, its just a single thread.
> 
> Any hints ?

On Linux the time spent doing a drawPixmap is mostly sending a command 
to the X server and returning immediately. The actual drawing happens in 
a different process and is not visible unless the application does a 
QApplication::sync().

Are you creating these pixmaps on the fly or are they static between calls?

If there is sporadic time differences, my best guess would be that GC is 
kicking in frequently. Do you have a lot of allocations in your code?

On Windows back in the Qt 3 days, QPixmaps used GDI objects which was a 
pool of 10k objects per process. If the total number of fonts, pixmaps, 
icons, windows etc grew beyond 10.000 the process would start behaving 
"weird". This is much less a problem in Qt 4 as neither pixmaps, icons 
nor windows use native GDI handles anymore.



More information about the Qt-jambi-interest mailing list