I've recently noticed an interesting feature of GMP's implementation of mod_pow (ie modular exponentiation). I'm using this as part of random-base WEP on large M+2's. Anyway I always imagined, and hoped it would use "Russian Peasant" (see earlier post on this blog for description of that). If that is the case,
http://gmplib.org/manual/Powering-Algorithms.html#Powering-Algorithms
there should theoretically be a speed advantage to testing numbers that are (very) close to a power of 2 (as M+2's obviously are). And indeed I am observing just that - a 40% (!) speed increase testing the _raw_ M+2, rather than dividing out any factors (even though dividing out factors obviously leaves a slightly smaller number).
Wednesday, 12 December 2007
Subscribe to:
Post Comments (Atom)
1 comment:
...though interestingly, leaving the small factor of 3 in, seems to suppress finding of larger factors - perhaps because of WEP's semi-similarity/semi-heritage to NFS?
Post a Comment