On Apr 21, 12:11 am, Paul Rubin <http://phr...@nospam.invalid> wrote: > casevh <cas...@gmail.com> writes: > > Python 3.1 is significantly faster than Python 2.x on 64-bit > > platforms. The following times are for multiplication with 2, 30 and > > 300 decimal digits. > > Could you test pow(a,b,c) where a,b,c are each 300 decimal digits? > This is an important operation in cryptography, that GMP is carefully > optimized for. Thanks.
$ py25 -m timeit -s "a=long('23'*150);b=long('47'*150);m=long ('79'*150)" "c=pow(a,b,m)" 10 loops, best of 3: 52.7 msec per loop $ py31 -m timeit -s "a=int('23'*150);b=int('47'*150);m=int('79'*150)" "c=pow(a,b,m)" 100 loops, best of 3: 8.85 msec per loop $ py25 -m timeit -s "import gmpy;a=gmpy.mpz('23'*150);b=gmpy.mpz ('47'*150);m=gmpy.mpz('79'*150)" "c=pow(a,b,m)" 1000 loops, best of 3: 1.26 msec per loop casevh -- http://mail.python.org/mailman/listinfo/python-list