This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

_Jv_HashCode


Current _Jv_HashCode is defined thusly:

    inline jint
    _Jv_HashCode (jobject obj)
    {
      return (jint) obj;
    }

I wonder if this should be `(jint) obj >> 2' instead.
That would put more information in the low bits.

This matters in some situations.  For instance, the interned string
hash table has a size that is a power of 2.  In this case 3/4 of the
entries in this table will only be used when there are collisions.

Comments?  Does hash code computation have to be maximally fast?  Will
a shift cause problems?  (To me it seems unlikely.)

Tom

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]