[ENH] Ten Percent Faster Morphic! (with conversion)

John M McIntosh johnmci at smalltalkconsulting.com
Mon Aug 5 19:26:10 UTC 2002


>  > Could we make all really small hashed structures do linear searches?
>>
>>  - Stephen
>
>
>You beat me to it!  With a little refactoring, you can put this strategy
>in Set and make every hashed collection do it.  It will be a smidgen
>slower, probably, than using an OrderedCollection.  But then you don't
>have to manually figure out which of your collections will be small and
>write uglier code to manage them.  Furthermore, you don't have to worry
>about performance when the collections grow.
>
>One idea, by the way, is to use an object to hold the searching and placement
>strategy. Then you replace al the "if size < 4" statements by a 
>polymorphic call
>to the strategy object.  In fact, if you look up Strategy (I think 
>it's Strategy) in
>the design patterns book, then a very relevant example pops up.  :)
>
>
>-Lex

MMM if I remember correctly VisualAge V2.x or so, maybe even in the 
current version? used this logic in their dictionaries.

Which type of storage structure used was dependent on the size of the 
collection, thus small dictionaries were linearly searched etc. Of 
course last I looked was about 5 years ago, anyone remember the 
details?
-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list