Python and GMP.

Paul Rubin http
Tue Apr 21 08:47:32 EDT 2009


casevh <casevh at 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.



More information about the Python-list mailing list