[Kde-games-devel] Review Request: New classes KGameRenderer and KGameRenderedItem

Parker Coates parker.coates at kdemail.net
Wed Jun 16 20:17:21 CEST 2010



> On 2010-06-14 17:36:46, Parker Coates wrote:
> > trunk/KDE/kdegames/kdiamond/src/staging.cpp, lines 101-103
> > <http://reviewboard.kde.org/r/4283/diff/3/?file=28571#file28571line101>
> >
> >     This is just a matter of personal style, but I'm curious of why you don't just use a foreach loop.
> 
> Stefan Majewsky wrote:
>     When I was working on a cellular automaton engine (a private pet project), I could increase the iteration performance ten-fold by replacing foreach by const_iterator loops (from 10fps to 100fps). That was some kind of epiphany for me, so now I avoid foreach when the loop is likely going over very much elements or called very often.

Were you using const references or making copies of each object? When using const references, the speed of a foreach loop should be quite close to that of manual iterators. If speed is a major concern, using an integer for loop and QList::at(int) is actually the fastest.

Have you read this: http://labs.trolltech.com/blogs/2009/01/23/iterating-efficiently/


- Parker


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/4283/#review6114
-----------------------------------------------------------


On 2010-06-13 20:54:58, Stefan Majewsky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4283/
> -----------------------------------------------------------
> 
> (Updated 2010-06-13 20:54:58)
> 
> 
> Review request for KDE Games.
> 
> 
> Summary
> -------
> 
> KGameRenderer is a small SVG->PNG rendering framework for use in KDE games. For the story behind it, see http://kde.markmail.org/message/plfkwfeoni6nvpk2
> 
> This diff reflects the current state of my local work branch: KGameRenderer is in a single source file inside the KDiamond source tree. I am in the process of porting KDiamond to KGameRenderer alongside writing KGameRenderer for testing reasons.
> 
> The relevant code is in the files "staging(-p)?.(h|cpp)". Eventually, KGameRenderer shall be moved inside libkdegames. I will take care of porting all applications in the kdegames module to KGameRenderer where it is fruitful.
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdegames/kdiamond/src/staging.h PRE-CREATION 
>   trunk/KDE/kdegames/kdiamond/src/staging.cpp PRE-CREATION 
>   trunk/KDE/kdegames/kdiamond/src/staging_p.h PRE-CREATION 
> 
> Diff: http://reviewboard.kde.org/r/4283/diff
> 
> 
> Testing
> -------
> 
> KDiamond still works, and even feels a bit faster although I have yet to fully take advantage of KGameRenderer's facilities.
> 
> 
> Thanks,
> 
> Stefan
> 
>



More information about the kde-games-devel mailing list