[BUG] Symbol>>hash

Lex Spoon lex at cc.gatech.edu
Thu Aug 3 13:05:45 UTC 2000


Stephan Rudlof <sr at evolgo.de> wrote:
> > > biggerHash
> > >
> > >         self size <= 2 ifTrue: [^self hash].
> > >         ^self inject: self size into: [ :sum :each | (sum + sum + each asciiValue) bitAnd: 16rFFFFFF]
> > 
> > I think this was what the current hash was meant to avoid. Perhaps we
> > could change it into something not so expensive, but simply better...
> > something that gives you 24 bits of hash.
> 


Someone mentioned a great strings implementation they had done in
another language.  One of the tricks it use was to cache the hash value:
after all, most strings don't change very often.

And for some kinds of hashes, you could even incrementally update it
whenever someone does at:put:....


-Lex





More information about the Squeak-dev mailing list