Hash rehashed (was: [SqF]Report of VI4 Project for Feb '02)

Tim Rowledge tim at sumeru.stanford.edu
Tue Feb 5 00:18:06 UTC 2002


Is there any value in making the putative hash-multiplier be dependant
upon the size of the collection into which the object is being put?
The downside that immediately pops up is that this value would then
change as you grow the collection which would presumably require moving
all the previously placed objects; except of course when you grow a
collection you have to copy all the entries to the new array anyway, at
least in most cases.

This could be implemented by adding an instvar to all collections,
though I fear that would be rather wasteful since so many collections
are small enough that the multiplier would be 1. If a single list of
values would be good (ie all varieties of collection can use the same
values) then a trivial prim could take the array size, the object hash
and do the entire lookup/algorithm - multiply - modulo operation.

tim
-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Strange OpCodes: HALT: No-Op




More information about the Squeak-dev mailing list