> -----Original Message-----
> From: Stefan Fuhrmann [mailto:[email protected]]
> Sent: zondag 25 april 2010 16:52
> To: [email protected]
> Subject: [PATCH] Saving a few cycles, part 1/2
>
> Hi devs,
>
> further reducing my backlog of patches sitting in my
> working copy, this and the next patch optimize code
> locally - shaving off cycles here and there. The net
> effect is somewhere between 3 and 10 percent
> for repository access (ls, export, etc.).
>
> In this patch, I eliminated calls to memcpy for small
> copies as they are particularly expensive in the MS CRT.
If you don't use the intrinsincs (or IA-64), this is the sourcecode from the
MS CRT in VS2010.
(See %PROGAMFILES%\Microsoft Visual Studio 10.0\VC\crt\src\memcpy.c)
void * __cdecl memcpy (
void * dst,
const void * src,
size_t count
)
{
void * ret = dst;
/*
* copy from lower addresses to higher addresses
*/
while (count--) {
*(char *)dst = *(char *)src;
dst = (char *)dst + 1;
src = (char *)src + 1;
}
return(ret);
}
Where would this be slower than the code you tried to replace it with?
Are you sure the overhead isn't in calling the C runtime in a separate DLL?
Bert