KDevVarLengthArray: memmove / memcopy?

Esben Mose Hansen kde at mosehansen.dk
Thu Jun 23 20:20:14 UTC 2011


On Thursday 23 June 2011 20:42:20 Milian Wolff wrote:
> So my question: Would memmove/memcopy (which one should be used?) be more 
> efficient?

At least on some platforms (that is, every one I have tested on), biggish 
memmoves/memcopys are a lot faster than a loop. Though that was long enough 
ago that Duff's device (see wikipedia) actually made a difference over a naive 
loop (circa. year 2003)

As for which, use memmove if the src and dest may overlap (which I presume 
they will), otherwise, use memcpy. I think that is pretty much the only 
difference there is. 

-- 
Kind regards, Esben




More information about the KDevelop-devel mailing list