[Kde-games-devel] QGraphicsScene performance

Ian Wadham ianw2 at optusnet.com.au
Fri Jun 29 02:02:17 CEST 2007


On Fri, 29 Jun 2007 02:35 am, Fela Winkelmolen wrote:
> I just did a small test with a QGraphicsScene with a few balls bouncing
> around, I noticed that with about 10 balls it starts becoming slow on my
> system (using 100% of my cpu), while on the Windows computer of my roommate
> it seems to take more than twice that amount, but but his computer should
> actuallll be sower than mine, so I was wondering what was causing the
> difference, does the painting take advantage of graphic hardware
> acceleration? Because that could explain it (damn ATI that doesn't provide
> proper drivers...).
>
Did you try export QT_FLUSH_PAINT=1?  It can make the reasons for
these things visible.  IIRC, Windows is expected (by Trolltech) to be
inherently faster because there is no tic-tacking with the X-server.
In Windows versions of Qt, as I understand it, QImage and QPixmap
forms of a graphic are equivalent.  In Linux/Unix, pixmaps are held
in the X-server and there is much to-ing and fro-ing during rapid
changes in the graphics or conversions of QImage.  The bigger the
area to be updated, the worse it gets.  Try running the "top" command
while your test executes.  You should see X coming to the top of the
list.  Anyway, that's what was happening with Qt 4.0 and KGoldrunner
about 6 months ago.  Graphics cards do not seem to have a great
bearing on this.  Mine is always off in Linux (no driver installed).

> At the end I think I will just use QGraphicsScene
> for KBreakout, after all I don't think there is need to have more than two
> balls at a time very ofter and a few bonus objects falling down. We have to
> be just a bit carefull to not write _to_ crazy levels...
>
Yes.  That's reasonable.  KGoldrunner with KGV was failing on just
a small percentage of levels and the timing was out of whack in some
existing levels, but we would have had to find all those levels, among
200 or so, and delete them ... :-(  We also have to consider people
in the world who do not have multi-GHz machines.

All the best with KBreakout, Ian W.


More information about the kde-games-devel mailing list