[BUG] Symbol>>hash

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Thu Aug 3 22:34:44 UTC 2000


Eric Arseneau wrote:

> As far as removing the hash on Symbol, I would be careful with that.  I'm
> sure the VM does not care too much, but there may be some issues with
> MethodDictionary.  I don't know how the VM does its lookup for methods, but
> I assume that it implements the hash lookup on the MethodDictionary
> structure natively.


Re. hashing efficiency--I looked at this a while ago, since the lookup
algorithm seems really simple, it doesn't use even the simplest
optimizations it seems, like double hashing, Robin Hood hashing, etc. But
the thing is that the method lookup in the vm uses the exact same algorithm
as MethodDictionary (for obvious reasons). And there it works extremely
well. The simplicity means that the code contains no expensive operations,
like long divides for better distribution or a "double hash" step size, no
wrap around checks, etc. But even so, the number of visited slots in the
hash table was really low, for things like finding out that a method is not
there (ie. need to continue look in a superclass), and so on. Given that the
cost of going to the next superclass is much higher, it would seem hard to
improve that part.

(Btw, this is why making the MD's more compact would probably reduce
performance a great deal--you'd have to look in many more slots to get a
miss.)

So I was pretty impressed by that and dropped the hashing project. No doubt,
extreme cases will require special measures, but the general case seems hard
to improve.

Henrik






More information about the Squeak-dev mailing list