icefox tests issues
Dario Massarin
nekkar at libero.it
Thu Oct 21 12:28:12 CEST 2004
On Wednesday 20 October 2004 20:21, Zack Rusin wrote:
> On Wednesday 20 October 2004 13:35, Matt Rogers wrote:
> > AFAIK, using it++ in Qt/KDE is worse because a temporary object is
> > created, but i could be _completely_ wrong. So this _might_ (very
> > slim possibility) cause a speedup, but caching the value of end()
> > might have more effect.
>
> This is not really true for complex types.
> For example:
> class A {
> class Itr {
> Itr operator++(int) {
> Itr tmp = *this;
> ++(*this);
> return tmp;
> }
> };
> };
> Now in order to optimize this we would need to have intimate knowledge
> of what the copy constructor on those bad boys do. If we would have
> even the simplest code in there like
> "... ++globalCopies; ... " where globalCopies is some static var then
> we're done. So essentially for C++ programs compilers optimize the
> post-increment only for basic types. Everything else is either not
> touched at all or just very loosely checked and you should never depend
> that you even have a shot at compiler optimizing it for you.
>
> Zack
And big thanks to you, Zack who made me discover this topics a lot of time ago
with a very useful guide :-)
Since then I wrote all my code with this in mind.
I propose to remember everyone, once again, the existence of these tips&tricks
becouse it seems someone doesn't know them, yet.
Have a nice day!
Dario
More information about the Kde-optimize
mailing list