[squeak-dev] Daily Commit Log

commits at source.squeak.org commits at source.squeak.org
Thu May 19 23:55:07 UTC 2011


Changes to Trunk (http://source.squeak.org/trunk.html) in the last 24 hours:

http://lists.squeakfoundation.org/pipermail/packages/2011-May/004713.html

Name: Kernel-nice.589
Ancestors: Kernel-dtl.588

Optimize the way to count number of printed digits for Integer
- by using iteration rather than recursion,
- by providing a slightly better guess in the decimal case.
Accelerate #raisedTo:modulo: because this operation is critical in cryptography.
Avoid using recursive #raisedToInteger:modulo: for same speed reasons, and deprecate it.
Sorry to sacrifice simplicity, hope you'll understand..

Implementation notes:
#raisedTo:modulo: now uses the new montgomeryTimes primitive if present.
Otherwise, it fallbacks to classical multiplication, remainder sequences.
The Montgomery algorithm avoids division implied by the modulo operation and thus save a few CPU cycles (see http://en.wikipedia.org/wiki/Montgomery_reduction for an introduction).
Both Montgomery and fallback version use a sliding window algorithm.
It consists in exponentiating by bit packets rather than bit by bit and then save some multiplications.
It is a classical CPU vs memory tradeoff. Hope the comments help if you're interested.
Note that raisedTo: could also use a slidingWindow if we want to. Do we?
In such case, we would have 3 most identical methods and should think of a better refactoring.

=============================================



More information about the Squeak-dev mailing list