cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From volker.schm...@basf-it-services.com
Subject Antwort: RE: [RT]: Calculating the cache key
Date Wed, 29 May 2002 07:04:02 GMT






Berlin Loritsch wrote:

<snip>
>There are two things you need to know about the default hashCode()
>for this to work:
>
>1) Default hash values are the address of the object--meaning that
>   they are all aligned on a power of 2 ( typically every 4 or 8
>   bytes depending on 32 or 64 bit machines ).
>
>2) Very regular hash values (like the default) will heavily weight
>   themselves to a particular buckets in the hash table (I found this
>   out creating the new BucketMap in Avalon collections).

>3) You must ensure that the resultant hashCode is not an even number,
>   this will help ensure a more even distribution of hashvalues.  (this
>   is what the String hashCode tries to do).
>
>4) The hashing algorithm must be quick--but it can be cashed for a
>   quick access.  That way if multiple tests on the hashCode occur,
>   you can save an expensive recalculation phase for each code.

sorry, but I don't understand why the resultant hashCode should not an even
number. My understanding of a hashCode funktion is, that it should generate
homogeneous values.

Volker



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message