[Qt-jambi-interest] QPixmap erratic performance depends on size of QPixmap
Gunnar Sletta
gunnar at trolltech.com
Thu Nov 20 08:56:32 CET 2008
> Hi Gunnar
>
> thanks for the tip. I had already played with this a bit, and must probably
> come to the conclusion that the only way to do really smooth animation is to
> go fullscreen, so that nothing else interrupts the communication with the
> graphics server. Otherwise I'll always have somewhat erratic/unsmooth
> animation.
The fact that the Xserver runs in a separate thread, has never been a
problem in acheiving smooth animations, at least not for me. The timings
you see in the code are simply bogus because they don't represent the
actual drawing. The X server draws as fast as it can and does so rather
well. GC on the other hand is a huge problem and always will be if you
have 1 or more allocations in your entire code path.
> Any chance that the new animation features in Qt4.5 will help me get really
> smooth multi-object animation?
There are no new animation features in Qt 4.5. Maybe you are talking
about the animation framework
http://trolltech.com/products/appdev/add-on-products/catalog/4/Utilities/qtanimationframework
This is not part of Qt, but will most likely be included into Qt when
its ready, Qt 4.6 at the earliest.
> What about the Java overhead? Would we get significant gains with going to
> C++? At least we wouldn't have occasional garbage collection to mess up our
> animation.
I tend to think that smooth animations in Java are impossible unless you
preallocate every single bit you need and never loose a reference to those.
You can remove the cost of GC by having your animations be time
dependent, rather than tick dependent. If GC blocks your animation moves
at 10 pixels pr second, and you're running at 10 fps, then you need to
move 1 pixel per frame. Now if the GC comes and blocks your process for
500 ms, you need to compensate and move 5 pixels that frame. It will
still lock up for short times, but the animation won't feel jerky.
Smooth animations in C++ are a lot simpler because performance is
deterministic, no GC, only have one thread in the application and no
JIT'ing to have slower startup.
best regards,
Gunnar
More information about the Qt-jambi-interest
mailing list