Patch: convenience routines for hashtab.c

Mark Mitchell mark@codesourcery.com
Thu May 4 07:39:00 GMT 2000


>>>>> "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


More information about the Gcc-patches mailing list