cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: [RT]: Calculating the cache key
Date Tue, 28 May 2002 13:20:31 GMT

Berin Loritsch wrote:
> > > 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.
> > >
>
> Maybe so, but those things do need to be kept in mind.
>

Yes, thanks for this information Berin, I changed the hashCode
implementation,
it produces now odd numbers (at least I hope so).

Thanks
Carsten


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


Mime
View raw message