QCString construction
David Faure
dfaure at klaralvdalens-datakonsult.se
Sat Feb 10 02:16:25 CET 2007
This leads me to 3 patches.
One for kmail, I wrote a utility function for creating a QCString from char*+size, and used that
when creating a QCString from a DwString where it matters (i.e. where I found pretty large strings
to be used when attaching large files).
Can a kmail developer review the change to KMMessage::asString() and asSendableString(), too?
It avoids a asString() (Assemble) and a fromString (Parse), but I hope it's doing the right thing.
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 ;)
And one for mimelib, not really related to QCString: am I right that memcpy is faster than for (i=0; i < pos1; ++i) *to++ = *from++; ?
At least in gdb it seems faster, but I didn't benchmark it. Hopefully memcpy is done by a single CPU instruction or something, right?
Finally, I wish we could avoid the data copying just to null-terminate it in KMMessagePart::body(), but I'm not sure how...
--
David Faure, faure at kde.org, dfaure at klaralvdalens-datakonsult.se
KDE/KOffice developer, Qt consultancy projects
Klarälvdalens Datakonsult AB, Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qcstring.h.diff
Type: text/x-diff
Size: 810 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-optimize/attachments/20070210/396d3c42/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dwstring.cpp.diff
Type: text/x-diff
Size: 1000 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-optimize/attachments/20070210/396d3c42/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kmail.diff
Type: text/x-diff
Size: 5577 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-optimize/attachments/20070210/396d3c42/attachment-0002.bin
More information about the Kde-optimize
mailing list