In between SmallIntegers and LargeIntegers...FloatIntegers?
Bijan Parsia
bparsia at email.unc.edu
Thu Apr 18 19:08:56 UTC 2002
On Thu, 18 Apr 2002, Jesse Welton wrote:
> Bijan Parsia wrote:
> >
> > Summary: "An even simpler possibility is to use floating point operations
> > for semi-long integers."
> >
> > It made me wonder want the impact of a scheme like that would be on
> > Squeak. I.e., would some loops benefit? How about all over memory
> > consumption? etc.
>
> Unless this has changed recently, Squeak already uses floats for the
> integer arithmetic in its pseudorandom number generation.
Interesting! I wouldn't have guessed! Thanks for the pointer.
> When I
> played with this a couple of years ago, it was definitely much faster
> than using ints which overflowed into long ints. Surprizingly, it was
> even faster than ints constrained to a short int range by arbitrarily
> reducing the modulus of the arithmetic.
Wow. That's a bit surprising. But indeed:
"This Random Number Generator graciously contributed by David
N. Smith. It is an adaptation of the Park-Miller RNG which uses Floats to
avoid the need for LargeInteger arithmetic."
I wonder if this is still faster than the current LargeInteger support...
> I never fully understood why.
Perhaps the cost of the integer calculations outweighed the cost of
unboxing?
I wonder if this would speed up SecureHasAlgorithm...and on which
architecture. Hmm. Probably kill on the iPaq with that FPless Arm...
Cheers,
Bijan Parsia.
More information about the Squeak-dev
mailing list
|