comments on KDE performance tips

Maks Orlovich kde-optimize@mail.kde.org
Fri, 17 Jan 2003 20:27:55 -0500


>
> c. Use QString as it first compares the location of the string before
> doing the actual char by char comparison.

It _does_ use QString (actually two QString's and some ints in a structure; 
but this is all academic, since KConfig exposes so much of its internal 
storage that changing it isn't possible before KDE4; at least I don't see a 
way). And this doesn't help you for doing less-than equals comparisons, which 
is what is needed for tree insertions and lookups.

<snip stuff I really can't comment on>

> 	* found a little optimization opportunity in QString.
>
> 	bool operator!=( const char *s1, const QString &s2 )
> 	{ return !(s1==s2); }
>
> 	Should return !(s2==s1) instead since (s1==s2) will match
> 	 ==(const char *, const QString &) in its turn.


Yeah, I think so, good catch.

> 	A compiler with automatic inlining will help...


gcc-3.x inlines quite a bit by default with -O2.