[BUG] Unscalability in collections.

Lex Spoon lex at cc.gatech.edu
Wed Oct 10 00:00:39 UTC 2001


> Been there, tried it. doesn't work. I refactored out
> ProtoObject>>hashBits, made method dictionaries use that. This works; no
> problem. Assume that I've already done that in my remarks below.

Ah, you're right.  It crashes *fast* (so it's not running out of memory
due to does-not-understand recursions), with no output (so it's not a
segment fault), and with a successful error code (which I don't see
could happen at all).  All very mysterious.

One thing does come to mind: the VM assumes that MethodDictionaries will
be hashed based on #hashBits, so it's important to swap over the
Smalltalk level code to use #hashBits instead of #identityHash.  I only
found one send of this method in MethodDictionary.


One little trick: define a global SwitchOver, and if it's false, have
#identityHash do it's previous behavior.  Then you can do a do-it like
this:

        SwitchOver := true.  Smalltalk allObjectsDo: [ :o | o rehash ]

Thus, you don't have to run the compiler in between the switchover and
the time the rehash happens.

Well anyway, someone pointed out that IdentitySet and IdentityDictionary
already cover up for limitations of #identityHash, and so fixing #hash
ought really to be good enough, anyway.


-Lex




More information about the Squeak-dev mailing list