Re: QCString construction

George Staikos <[email protected]> Fri, 9 Feb 2007 20:22:13 -0500
Newsgroups gmane.comp.kde.devel.optimize
Message-ID <[email protected]>
On 9-Feb-07, at 8:16 PM, David Faure wrote:

> 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.

   IIRC there are lots more cases of mimelib doing things like this  
including in the internals.

> 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?

    memcpy() is often implemented with vector operations so it should  
definitely be faster in many cases.

--
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/