Efficiency of memmove vs. generic typed copy

Gabriel Dos Reis gdr@integrable-solutions.net
Sun Dec 11 17:34:00 GMT 2005


Paolo Carlini <pcarlini@suse.de> writes:

| 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 :(

I agree.  But, I cannot promise to do that now;  I'll send what I have
for valarray (be prepared to scream for ABI breakage for no "good" reasons).

-- Gaby



More information about the Libstdc++ mailing list