You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Brandon Ehle <az...@yahoo.com> on 2002/11/26 07:04:42 UTC

Something I noticed when looking at update performance with char_is_uri_safe

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. 
 Not a big deal, just that I noticed that strchr was getting a little 
bit raped for no apparent reason. :)




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by Michael Price <mp...@atl.lmco.com>.
Michael Price writes:
 > So given that your three heavy hitters are the first three characters in
 > the string,

Um... ok. So I have trouble reading.

This should say something like "this is a good argument for making those
three characters come first in the string".

Michael



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by cm...@collab.net.
Greg Hudson <gh...@MIT.EDU> writes:

> On Tue, 2002-11-26 at 10:56, Michael Price wrote:
> > 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.
> 
> But char_is_uri_safe could be made a macro using a character table.

Indeed!  In fact, the filesystem skel stuff uses such a table for
determining the skel-safety-ness of characters in skel data.

  static const enum char_type skel_char_type[256] =  ...

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2002-11-26 at 10:56, Michael Price wrote:
> 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.

But char_is_uri_safe could be made a macro using a character table.

> Put your working copy on an NFS
> mount and you will see a new definition of pain and suffering. This
> strchr() is nothing.

That's quite possible.  I didn't catch how much time is spent in
char_is_uri_safe.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by Michael Price <mp...@atl.lmco.com>.
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