_Jv_HashCode

Tom Tromey tromey@cygnus.com
Tue May 9 17:57:00 GMT 2000


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


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /