[RFC] Integer hash

Andreas Raab Andreas.Raab at gmx.de
Wed Aug 7 21:33:29 UTC 2002


Folks,

You might not have noticed the discussion about Magma's performance but
one issue that came up was that LargeInteger>>hash has a pretty poor
implementation. It currently says

Integer>>hash
	"Hash is reimplemented because = is implemented."
	^(self lastDigit bitShift: 8) + (self digitAt: 1)

and the request has been made to change this into

Integer>>hash
	"Hash is reimplemented because = is implemented."
	^self bitAnd: 16r3FFFFFFF

so as to get better hashes (more values, larger spread). This request is
meant to find out if anyone could see a reason not to make that change.
Personally, I don't see any but since the change means that many
sets/dictionaries will be affected I thought it might be a good idea to
ask if there's any objection to making that change.

If you see a reason not to change #hash in the proposed way, speak up
now or be ready to bear the consequences ;-)

Cheers,
  - Andreas




More information about the Squeak-dev mailing list