This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: convenience routines for hashtab.c
- To: vonbrand at inf dot utfsm dot cl
- Subject: Re: Patch: convenience routines for hashtab.c
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 04 May 2000 07:47:34 -0700
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <mark@codesourcery.com><200005041321.e44DLVb17826@pincoya.inf.utfsm.cl>
>>>>> "Horst" == Horst von Brand <vonbrand@inf.utfsm.cl> writes:
Horst> Yes. But the result is to be used as a hash, probably %ed
Horst> or even &ed to get rid of most of the bits later on. If &ed
Horst> (hash table size a power of 2, very nice for efficiency),
Horst> the 3 almost-always zero bits will hurt the distribution
Horst> badly.
I'll buy that.
>> Profiling is key here. If we're seeing lots of time in
>> hashing, and we observe that to be due to the low-order bits
>> being zero, then we should definitely do this. Otherwise, I
>> think we should just leave the code as simple as possible.
Horst> OTOH, how much extra cost does the >> introduce?
At run-time? None. At code-reading time? A little bit -- but
probably not enough to worry about.
I think your proposed change is OK. Sorry for being slow on the
uptake.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com