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

Ned Konz ned at bike-nomad.com
Sun Feb 25 19:51:55 UTC 2001


On Wednesday 21 February 2001 20:01, Yoshiki Ohshima wrote:

>   Your fix solves the particlar MethodDictionary case, but
> still there are other many Dictionaries that uses Symbols as
> keys.  I think their speed would be also important.

>   ... Umm, I was about to write "so let's use faster
> implementation of Symbol>>hash!"  I still think so, but
> because those "Symbol-key Dictionaries" typically used for
> classPools, converting the classPools to
> IdentityDictionaries seems a good thing anyway.

So why not just do this:

Cursor wait showWhile: [
	(Dictionary allInstances select: [ :ea | ea notEmpty and: [ ea keys 
allSatisfy: [ :key | key class == Symbol ] ] ])
		do: [ :ea | ea become: (ea as: IdentityDictionary) ].
	Smalltalk garbageCollect
].


It seems to work (though it takes a long time to run)...

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list