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

Re: svn commit: rev 2112 - trunk/subversion/libsvn_repos

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-06-07 22:59:44 CEST

On Fri, Jun 07, 2002 at 03:04:34PM -0500, Karl Fogel wrote:
> Ben Collins-Sussman <sussman@collab.net> writes:
> > Just a sanity check here, correct me if I'm wrong. The rule we're
> > following is, "if you know the length, use it. otherwise, use
> > APR_HASH_KEY_STRING."

Yes, that is the rule.

Note that it is possible to use binary values for hash keys, but we don't do
that. Of course, in that case, you will always be supplying a length.

> > Is that right? I mean, the constant is just
> > running strlen, right?
>
> Not quite. The reason to prefer the constant is that it tells the
> hash function "This is a null-terminated string, so compute the key
> length *while* you compute its hash value." So it only runs over the
> bytes once, instead of twice.

Exactly.

You can see the code in: apr/tables/apr_hash.c::find_entry(). (line 263)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 7 22:58:47 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.