[Glass] Why #identityHash does not rely on OOP?

Martin McClure via Glass glass at lists.gemtalksystems.com
Wed Oct 26 11:42:20 PDT 2016


On 10/26/2016 09:19 AM, Martin McClure via Glass wrote:
> hash collisions between persistent objects cannot happen.

I should also mention that this only applies to the results of the 
identityHash *method*, which is only the first half of the hash 
*function*. The second half of the hash function is up to the 
collection. It's often the result of the hash method modulo the table 
size. Once you've done that, you *can* (and almost certainly will) get 
collisions, and how bad the collisions are depends on the actual data 
you're putting in the collection (it's always possible to find a data 
set that performs terribly) and the choice of table size. See Pharo's 
HashTableSizes class for table sizes that work well for typical data sets.

Regards,

-Martin


More information about the Glass mailing list