[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 2/2

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Mon, 26 Apr 2010 16:40:54 +0100

Peter Samuelson <peter_at_p12n.org> writes:

> [Stefan Fuhrmann]
>> --- subversion/libsvn_subr/checksum.c (revision 937673)
>> +++ subversion/libsvn_subr/checksum.c (working copy)
>> @@ -206,12 +206,39 @@
>>
>> for (i = 0; i < len; i++)
>> {
>> - if ((! isxdigit(hex[i * 2])) || (! isxdigit(hex[i * 2 + 1])))
>> + char c1 = hex[i * 2];
>> + char c2 = hex[i * 2 + 1];
>
> Hmmmm. On the one hand, your open-coding of isxdigit will be less
> efficient than the original, which uses a table lookup. On the other
> hand, replacing isalpha is probably for the best, since isalpha is
> locale-sensitive.

We have svn_ctype_isalpha which is a macro that does a table lookup.
We don't currently have svn_ctype_isxdigit but it could be added.

> I'd rather see the whole thing become a single table lookup. Untested
> patch appended.

Is this a bottleneck? I think using the svn_ctype.h macros should be
sufficient.

-- 
Philip
Received on 2010-04-26 17:41:26 CEST

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