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
Nicolas
thanks! My question was also more interested :) If you want to see this bug to be fixed, submit a fix and a bunch of tests :). You look like that right guy to do that :)
Stef
On 28 mars 06, at 10:39, ncellier@ifrance.com wrote:
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 cove rs 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 !
On 28.03.2006, at 10:51, stéphane ducasse wrote:
Nicolas
thanks! My question was also more interested :) If you want to see this bug to be fixed, submit a fix and a bunch of tests :).
And don't be discuraged if something is not added/fixed fast... it will be at some point.
Marcus
squeak-dev@lists.squeakfoundation.org