Agner Fog wrote on 31 July 2008 07:14:

> Denys Vlasenko wrote:
>> I tend to doubt that odd-byte aligned large memcpys are anywhere
>> near typical. malloc and mmap both return well-aligned buffers
>> (say, 8 byte aligned). Static and on-stack objects are also
>> at least word-aligned 99% of the time.
>> 
>> memcpy can just use "relatively simple" code for copies in which
>> either src or dst is not word aligned. This cuts possibilities down from
>> 16 to 4 (or even 2?). 
>> 
> The XMM code is still more than 3 times faster than rep movsl when data
> are aligned by 4 or 8, but not by 16.
> Even if odd addresses are rare, they must be supported, but we can put
> the most common cases first.


  In the real world, unaligned memcpys are anything but rare.  Everything's
networked these days, remember?  Stuff gets misaligned real quick when you
start adding and removing various network layer headers and trailers to
unpredictably-sized packets.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

Reply via email to