[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-devel
Subject:    Re: KDevVarLengthArray: memmove / memcopy?
From:       Esben Mose Hansen <kde () mosehansen ! dk>
Date:       2011-06-23 20:20:14
Message-ID: 201106232220.14814.kde () mosehansen ! dk
[Download RAW message or body]

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

-- 
KDevelop-devel mailing list
KDevelop-devel@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic