Calculate Big Number

Gisle Vanem gvanem at broadpark.no
Tue Jan 8 05:06:09 EST 2013


"Steven D'Aprano" <steve+comp.lang.python at pearwood.info> wrote:

> py> from timeit import Timer
> py> t1 = Timer("(a**b)*(c**d)", setup="a,b,c,d = 10, 25, 2, 50")
> py> min(t1.repeat(repeat=5, number=100000))
> 0.5256571769714355
> 
> So that's about 5 microseconds on my (slow) computer.

That's pretty fast. So is there still a need for a GMP python-binding like
gmpy? http://code.google.com/p/gmpy/wiki/IntroductionToGmpy

GMP can include optimized assembler for the CPU you're using. But
I guess it needs more memory. Hence disk-swapping could be an issue
on performance.

--gv



More information about the Python-list mailing list