[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hashing, and NSDictionaries
From: |
Stephen Brandon |
Subject: |
Hashing, and NSDictionaries |
Date: |
Tue, 12 Mar 2002 19:14:04 +0000 |
Hi,
Just a query about the way NSDictionaries do their lookups.
It seems that although NSDictionary creates a hash of all keys handed to it,
once it finds a match between a stored hash and the hash of a (possible) key
sent to it, it then does an isEqual: between the stored key and the query key.
Why is this final equality check necessary? Isn't the fact that it already
has a hash of the stored key and the query key, and the fact that they match,
good enough?
In my situation, my -isEqual does a new hash of self and the other object and
compares them -- so the number of hashes done can be very large! And there's
quite a lot of redundant hashing going on.
Can anyone shed any light on this?
Cheers,
Stephen Brandon
- Hashing, and NSDictionaries,
Stephen Brandon <=