Horrible unscalability, how do I change hashBitsOf: ?

Stephen Pair spair at advantive.com
Sat Oct 6 18:18:17 UTC 2001


With only 5 bits for an object hash, the largest range of hash values is
going to be 4096, no matter what kind of algorithm you use to derive the
hash value from those bits (unless you mix some other data into that
algorithm as does SequenceableCollection).  If you want to expand the
hash range, the best way is to use some other data associated with the
object that is constant over its lifetime.  If there is nothing
suitable, then you could just add an instVar that keeps an extended hash
value...with SmallIntegers, you'll have enough of a range to map into
the entire object memory (larger than any collection could possibly
grow).  Also, there may be some additional data in the header that could
be used.  The usefulness of that would depend on the demographics of the
objects you intend to insert in your collection.

- Stephen





More information about the Squeak-dev mailing list