hash and equal problem

ncellier@ifrance.com ncellier at ifrance.com
Tue Mar 28 08:39:16 UTC 2006


Hi, Stef and Boris,

 We know from 1997-99 discussions that VA implementation is not good.
It computes hash code fast, but handle Set of Float inefficiently.
Example:
    ((1 to: 100) collect: [:i | 10.0 raisedTo: i negated]) asSet.
All elements have same hash code (0 hash) and access performance turn to linear search.

In other dialects,
    self=self truncated ifFalse: [...]
is also here to handle fraction/float equality (3/2) hash = 1.5 hash

VW used to convert everything to Fraction (and had nasty bugs because their imperfect asRational algorithm sometimes have (aDouble = aDouble asRational asDouble) answering false, see SYSBUG-asRational at cincom public store).
Now they convert everything to Float, then to Double if anything fail (Overflow) then to old Fraction hash (Large Fraction can also overflow max IEEE754 Double). I think new implementation is faster, and also covers other nasty bugs of aFloat=aDouble answering true, but having different fractional representations. This also cover scaled numbers.

 I do not have Dolphin, ST/X, ... image here, but i imagine they follow one of the above paths.

Sorry, I have no original solution in mind, but borrow solutions of our Smalltalk cousins.

 
 
________________________________________________________________________
iFRANCE, exprimez-vous !
http://web.ifrance.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20060328/b392379a/attachment.htm


More information about the Squeak-dev mailing list