[BUG][FIX][Slowdown] Add preference too slow (Symbol>>hashtoo slow)

Doug Way dway at riskmetrics.com
Wed Feb 21 04:53:25 UTC 2001


Dan Ingalls wrote:
> 
> Hi, Doug (and also Andrew Black) -
> 
> We discussed this, and propose to fix the problem a different way.  MethodDictionary is a subclass of Dictionary instead of IdentityDictionary (which didn't exist when MethodDict was defined ;-).  MethodDictionary overrides "scanFor:" to provide IdentityDictionary speed, but it inherits #keys from Dictionary and so produces a Set here instead of an IdentitySet.  Our proposal is to move methodDictionary to being a subclass of IdentityDictionary.  Hopefully this will fix the problem in a more general way.
> 
> Hmm, I just tried it out -- simply execute...
>         IdentityDictionary variableSubclass: #MethodDictionary
> ...and proceed through the cautionary notifier, heh-heh.  It all seems to work.  Why not? Want to give it a little QA (we're swamped (though I did recompile the system while writing this)) and tell us if it speeds up your example?

Okay, I did some testing, and it does speed things up nicely.  (After reverting my changeset 3636 speedup) I did the IdentityDictionary subclass thingy, and my addPreference test sped up by a factor of 4 or 5, similar to the speedup you saw.

I didn't really notice a speedup in the feel of browsers that Tim did, though.  At least, as a slow example, selecting the -- all -- category for the Morph class took about 0.5 seconds before the change, and 0.5 seconds after the change.  Nothing slowed down, though. :)

Also, I did some development for awhile in an image with this IdentityDictionary change, and everything seemed fine, so it's probably safe enough for 3.1alpha, anyway.

(For what it's worth, I would also prefer if Symbol were not a species of String, but we can leave that alone for now. :) )

- Doug Way
  dway at riskmetrics.com





More information about the Squeak-dev mailing list