This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Re: Patch: New hash function
- To: tromey at cygnus dot com
- Subject: Re: Patch: New hash function
- From: Jeff Sturm <jsturm at detroit dot appnet dot com>
- Date: Wed, 16 Aug 2000 16:14:22 -0400
- CC: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Organization: AppNet Inc.
- References: <87itt16wyk.fsf@creche.i-did-not-set--mail-host-address--so-shoot-me>
- Reply-To: jeff dot sturm at appnet dot com
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