dolphinsmalltalk / Dolphin

Dolphin Smalltalk Core Image
MIT License
301 stars 58 forks source link

Optimise comparison of ScaledDecimals #1120

Closed rko281 closed 3 years ago

rko281 commented 3 years ago

As per #1119, adds equalToScaledDecimal: double-dispatch handler in various ArithmeticValue subclasses.

To optimise SmallInteger=ScaledDecimal comparisons I initially added an implementation of = to Integer (implemented as per the primitive fallback code in LargeInteger>>#=) however this had a negative effect on SmallInteger=Float comparisons. Instead the performance of SmallInteger=ScaledDecimal comparisons has been improved by optimising Integer-ScaledDecimal subtractions - see ScaledDecimal>>#subtractFromInteger:. ScaledDecimal creation has also been optimised slightly by use of primitive 157.

Resolves #1119.