[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: [PATCH] Saving a few cycles, part 1/2

From: Bert Huijben <bert_at_qqmail.nl>
Date: Sun, 25 Apr 2010 22:47:07 +0200

> -----Original Message-----
> From: Stefan Fuhrmann [mailto:stefanfuhrmann_at_alice-dsl.de]
> Sent: zondag 25 april 2010 16:52
> To: dev_at_subversion.apache.org
> 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
Received on 2010-04-25 22:47:49 CEST

This is an archived mail posted to the Subversion Dev mailing list.