memcpy vs slice copy

Don nospam at nospam.com
Mon Mar 16 12:40:33 PDT 2009


Walter Bright wrote:
> Don wrote:
>> Oh. I didn't see it was only 6 bytes. And the compiler even KNOWS it's 
>> six bytes -- it's in the asm. Blimey. It should just be doing that as 
>> a direct sequence of loads and stores, for anything up to at least 8 
>> bytes.
> 
> The compiler will replace it with a simple mov if it is 1, 2, 4 or 8 bytes.
That's good.
In fact, in this case it's a pessimisation. It's quicker in debug mode, 
than release mode!



More information about the Digitalmars-d mailing list