Patch: New hash function
Jeff Sturm
jsturm@detroit.appnet.com
Wed Aug 16 13:03:00 GMT 2000
Tom Tromey wrote:
> + return (jint) ((unsigned long long) obj % 0x7fffffff);
Do we have any statistics showing an improvement with this new hashcode
function?
I'm not too crazy about the 64-bit modulus operator. I tested it on a couple of
machines I use:
CPU Old New
------------ --- ---
PIII, 600MHz 39 159
EV56, 533MHz 5 30
where "Old" and "New" are the previous and current hashcode functions,
respectively, and times are an average measured in cycles, using the rdtsc or
rpcc instructions. Both tests were compiled with gcc -O2.
I don't see a justification for "long long" arithmetic here anyway, using simple
"(unsigned long)" avoids a function call on the PIII, and has no effect on the
EV56, or any other 64-bit CPU where sizeof(long) == sizeof(void *).
--
Jeff Sturm
jeff.sturm@appnet.com
More information about the Java-patches
mailing list