[tested PATCH] let QString::lower() assume lower case input to avoid real_detach()

Lubos Lunak kde-optimize@mail.kde.org
Fri, 24 Jan 2003 13:39:52 +0100


On Friday 24 of January 2003 02:05, Roger Larsson wrote:
> As QString said in the earlier comments "could do this only when we find a
> change". This version does it like that. And works.
>
> This patch optimizes upper too but it is not a common case. At least not
> for konqueror. But I have written the code in a similar way to make it
> possible to change in a generic template for QString translation functions.
>
> Test results, after running konqueror for a while
>
> 		calls done (non empty)	strings that needed change
> upper()		  141			  140
> lower()		29990			 3624	almost 90% saved!
>
> Summary: Not worth it for upper, definitely worth it for lower.
> (You have to create that a temporary QString object anyway since
>  lower() is const, but this avoids creating a new QStringData,
>  and copying the strings themselves...)

 If it's tested patch, you could probably send it to qt-bugs@trolltech.com :).

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/