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

Re: Something I noticed when looking at update performance with char_is_uri_safe

From: Michael Price <mprice_at_atl.lmco.com>
Date: 2002-11-26 16:56:33 CET

Brandon Ehle writes:
> I noticed that some of the biggest hitters in the ltrace are:
>
> [...]
> 302==> strchr("/:.-_!~'()@=+$,&*", '-') =
> "-_!~'()@=+$,&*"
> [...]
> 2745==> strchr("/:.-_!~'()@=+$,&*", '_') =
> "_!~'()@=+$,&*"
> [...]
> 14751==> strchr("/:.-_!~'()@=+$,&*", '.') =
> ".-_!~'()@=+$,&*"
>
> I believe this is caused by this line in libsvn_subr\path.c:715 in
> char_is_uri_safe.
>
> if (strchr ("/:.-_!~'()@=+$,&*", c) != NULL)
> return TRUE;
>
> We could probably hand optimize that strchr with a couple if statements
> and save a bundle of time on machines with a slow version of strchr.

On BSD systems strchr() looks like this:

char*
strchr(const char *p, int ch)
{
        for (;; ++p) {
                if (*p == ch)
                        return ((char *)p);
                if (*p == '\0')
                        return (NULL);
        }
        /* NOTREACHED */
}

I'm sure other systems are similar if not an exact copy.

So given that your three heavy hitters are the first three characters in
the string, I'd say that replacing it with a couple of if statements won't
give you much of an improvement at all. Put your working copy on an NFS
mount and you will see a new definition of pain and suffering. This
strchr() is nothing.

Just my $.02

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 26 16:59:19 2002

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.