[gambit-list] Comparing gambit bignums with gmp 4.2.1

Bradley Lucier lucier at math.purdue.edu
Thu May 24 13:50:05 EDT 2007


I'll get these comparisons out now before gmp 5 comes out ;-).

Here are some comparisons with gmp for large integers. This is with  
the _num.scm I sent you earlier.

(define a (time (expt 3 2095903)))
(define b (time (expt 7 1183294)))
(define c (time (expt 11 1920505)))

I chose these numbers because they were used in a talk by Paul  
Zimmermann; I presume he chose them because

 > (map integer-length (list a b c (expt 10 1000000)))
(3321928 3321927 6643856 3321929)

I believe that on smaller numbers gmp should be significantly faster  
than gambit.

On my laptop (1.67GHz PowerPC 7450, gcc 4.1.2, 32 bit), times in seconds

                  Gambit         GMP 4.2.1
(* a b)            .907             .40
(quotient c a)    4.176            1.70
(integer-sqrt c)  4.179            1.35
(gcd a b)        55.494          224.31

On my desktop (2.0GHz PowerPC 970, gcc 4.1.2, 64 bit):

(* a b)            .352             .13
(quotient c a)    1.744             .59
(integer-sqrt c)  1.813             .46
(gcd a b)        24.071           36.56

On a server (2.2GHz Opteron, gcc 4.1.2, 64 bit):

(* a b)            .344             .17
(quotient c a)    1.550             .73
(integer-sqrt c)  1.526             .57
(gcd a b)        17.713           31.34


GMP was compiled with

gcc -O3 -mcpu=970 -m64 -o test test.c -I/pkgs/gmp-4.2.1-64/include/ - 
L/pkgs/gmp-4.2.1-64/lib -lgmp

and similarly for the other machines.

Brad



More information about the Gambit-list mailing list