[Qt-interest] QGraphicsOpacityEffect performance worse than QGraphicsItem::setOpacity()

Josiah Bryan jbryan at productiveconcepts.com
Thu Oct 15 14:37:09 CEST 2009


Jason H wrote:
> I haven't used these, but I have the same excitement as you do. I was worried about using them myself for just this reason. 
> 
> The problem is (as I see it) these are raster effects, which have to generate and cache their output. I would expect them to not cache if the StaticContent flag is not set on he source item. However, if it is set, the it should use a Pixmap or other cache. However this can only apply in part on some effects. Things like transparency need to update what is behind them. So there should also be an update region taken into account. 

I would hope that they would very aggressively cache their output. Where 
is the StaticContent flag you mentioned? I'm having trouble finding it 
via google.

With things like transparency, I don't see why they would have to 
re-render each paint() - just set the proper alpha value of the pixels 
in the pixmap and the drawPixmap() function can worry about compositing 
the pixmap with the background appros - no need to re-render the pixmap 
each time.

> I haven't had the time to look into look into it if these techniques are indeed done. 
> 
> Also, what drivers are you using? Does using a QGLWidget for the view make it better or worse?
> 

I havn't tried without the QGLWidget - but when using "-graphicssystem 
opengl" with a QGLWidget, performance goes *down*. Using graphics system 
raster, performance is "normal" (as described in my original email of 
this thread.)

This is such a disappointment that I'm looking at ripping the code for 
the drop shadow out of the library and just using it straight in my own 
app and do my own caching if the library can't provide acceptable 
performance.

Thanks for your time everybody. I'm open to any ideas on how to make 
this better!

Cheers!
-josiah



> 
> 
> 
> ----- Original Message ----
> From: Josiah Bryan <jbryan at productiveconcepts.com>
> To: Qt Interest <qt-interest at trolltech.com>
> Sent: Wed, October 14, 2009 12:54:10 PM
> Subject: [Qt-interest] QGraphicsOpacityEffect performance worse than QGraphicsItem::setOpacity()
> 
> I'm incredibly excited about the new QGraphicsEffect "module" in Qt 4.6. 
> Since the release of the beta last night (today?), I've integrated two 
> of the effects (opacity and drop shadow) into the project I've been 
> working on for the past two months (http://code.google.com/p/dviz/).
> 
> What I found, especially with regards to the opacity effect, was quite 
> surprising to me. Specifically, the performance of using 
> QGraphicsOpacityEffect to cross fade between QGraphicsItem's is 
> *considerably* worse than just using QGraphicsItem::setOpacity() 
> directly. A 30 frame, 250ms-long cross fade takes > 5 - 10 seconds due 
> to painting using QGraphicsOpacityEffect. Whereas using straight 
> QGraphicsItem::setOpacity(), we hit around 275ms - 500ms from start to 
> completion of the crossfade. (The 250ms is the target time, the time 
> between steps in the crossfade is calculated as 250 / 30 (QTimer is used 
> to trigger the frames). The actual painting of the items  often causes 
> the actual time to take a bit longer than 1ms to complete each frame, 
> pushing it out past the 250ms length. When using QGraphicsOpacityEffect, 
> we're hitting north of 150ms - 250ms *per repaint*. Under straight 
> setOpacity(), its around 1 - 4ms per repaint. And this is a *simple* 
> scene - two rectangular QGraphicsItems - and thats it!
> 
> An additional blow to my excitement was the performance of 
> QGraphicsDropShadowEffect on a simple rectangular custom QGraphicsItem. 
> Changing the blur radius, for example, from 1px to 5px takes around 
> 1/2second to re-render the scene. (Whereas, when rendering a "cheap" 
> drop shadow as just using drawRect() with a different color and offset 
> is imperceptibly fast.)
> 
> Those are the two major "problems" I've seen in this Qt 4.6 beta - and 
> that is on both Windows XP Pro and Linux (FC 8), with both very high end 
> graphics cards, dual / quad processor, 4 GB RAM. So the system isn't the 
> lag - it seems the library code is (at least on this end.) Anyone else 
> seeing similar problems?
> 
> Thanks for your time!
> 
> Cheers!
> -josiah
> 

-- 

-=-=-=-=-=-=-=-=-=-=-=-=-
Josiah Bryan
Productive Concepts, Inc.
jbryan at pciint.com
(765) 964-6009, ext. 224




More information about the Qt-interest-old mailing list