Efficiency of memmove vs. generic typed copy

Paolo Carlini pcarlini@suse.de
Sun Dec 11 11:59:00 GMT 2005


Paolo Carlini wrote:

>Gabriel Dos Reis wrote:
>
>>Do we have evidence that code B is generally faster than code A for
>>the majority of say primary platforms?
>>
>A few days ago I had your very same curiosity. I haven't done extensive
>tests, in particular not checked carefully the effects of restrict, but
>two points seemed obvious:
>1- For short copies, say, less than ~100 chars, the open coded loop was
>*much* faster.
>  
>
Well, a large fraction of this is due to inlining...

>2- For long copies, memcpy was a win, probably not by the same margin,
>but a clear win.
>  
>
... still, I'm consistently seeing this. I think we should first set up
tests comparing out of line open coded loops to out of line memcpy & co.
I haven't done that yet :(

Paolo.



More information about the Libstdc++ mailing list