[squeak-dev] About the utility of \\\
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Mon Nov 14 22:40:04 UTC 2011
\\\ is here to fast up \\ for large integers.
It gains roughly a factor 2 (COG VM) by multiplexing quotient and
remainder computation in a single primitive.
| a b |
a := (SmallInteger maxVal raisedTo: 3) + (SmallInteger maxVal*3) + 1.
b := (SmallInteger maxVal raisedTo: 2) + 2.
{[a \\ b] bench.
[a \\\ b] bench.}
#('331,000 per second.' '643,000 per second.')
Due to high usage of modular arithmetic in cryptography, this is not
totally useless.
However, I note that this message can also create a noticeable slow
down for moderately LargeInteger,
(presumably when the quotient is not large)
| a b |
a := (SmallInteger maxVal raisedTo: 2) + (SmallInteger maxVal*3) + 1.
b := SmallInteger maxVal << 4 + 1.
{[a \\ b] bench.
[a \\\ b] bench.}
#('6,670,000 per second.' '797,000 per second.')
I wonder if this message is worth at the end...
Nicolas
More information about the Squeak-dev
mailing list
|