On Fri, 23 Sep 2011, Marcus Denker wrote:
On Sep 23, 2011, at 1:08 PM, Denis Kudriashov wrote:
Hello,
I use hash message to generate unique object id. (unique between current memory objects). And I catch situation when two objects has same hash value. Objects has been created in loop almost at same time.
So my question - is it really possible?
Yes, easily, as there are only 12 bits for the hash, there are only 4096 different hash values.
This means that a hash is *not* at all a UUID, and all hashing data structures need to be optimized for the case of hash collision, as it will happen a lot.
Not all hashed collections, just those which rely on identityHash. Also, they are not fully optimized. Significant improvements can be done with a new primitive. Levente
Marcus
-- Marcus Denker -- http://marcusdenker.de