On Apr 21, 5:47 am, Paul Rubin <http://phr...@nospam.invalid> wrote: > casevh <cas...@gmail.com> writes: > > > Could you test pow(a,b,c) where a,b,c are each 300 decimal digits? > > > $ 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 .... > > 100 loops, best of 3: 8.85 msec per loop > > $ py25 -m timeit -s ..."import gmpy ... > > 1000 loops, best of 3: 1.26 msec per loop > > Wow, thanks. gmpy = 40x faster than py2.5. Ouch.
Remember this is on a 64-bit platform using the latest versions of MPIR or GMP. The ratio would be less for older versions or 32-bit versions. casevh -- http://mail.python.org/mailman/listinfo/python-list