QCString construction
Roger Larsson
roger.larsson at norran.net
Sat Feb 10 18:45:33 CET 2007
On Saturday 10 February 2007 02:16, David Faure wrote:
>
> One for Qt itself: why does QCString use the slow way when duplicating
> QCStrings? (I know that QCString tmp( s1 ); is shallow copy, but the next
> line calls operator+= which calls detach) Unless someone spots a flaw in
> this patch I'll be posting it to TT (and I'm testing my local kde with it
> starting from tomorrow ;)
I think it is because all these will require detach, so a new string has to be
allocated anyway.
But will it be large enough to avoid an extra copy when appending?
The tmp constructors could use a hint that they will grow.
That could be done in the append anyway...
Have you benchmarked that your Qt patch really is faster?
/RogerL
More information about the Kde-optimize
mailing list