SelectorTables

Tim Olson tim at jumpnet.com
Mon Apr 13 13:45:47 UTC 1998


>Folks,
>
>why are there multiple SelectorTables (see Symbol) (6 in my 1.31 image)?

The selectors are divided into 6 separate SelectorTables, based upon how 
many arguments they have (1, 2, .. 6+).  This is a quick way to reduce 
the search space when intern:ing a selector string, since you know the 
number of arguments in the string and that has to match with the possibly 
already existing symbol.

I did find it interesting that once a selector table is chosen from the 
number of selectors and the initial character, the code then proceeds 
with a linear search.  I would have expected the tables to use 
SortedCollections instead of Arrays, and use 
SortedCollection>>indexForInserting: to search the table, rather than a 
linear search of the array.  Because new compiled code tends to use 
existing selectors much more than define new selectors.

     -- tim





More information about the Squeak-dev mailing list