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
Afficher les réponses par date
On May 24, 2007, at 1:50 PM, Bradley Lucier wrote:
(define a (time (expt 3 2095903))) (define b (time (expt 7 1183294))) (define c (time (expt 11 1920505)))
On my desktop (2.0GHz PowerPC 970, gcc 4.1.2, 64 bit): 4.0b22 gmp 4.2.1
(* a b) .352 .13 (quotient c a) 1.744 .59 (integer-sqrt c) 1.813 .46 (gcd a b) 24.071 36.56
For bigger numbers, with about 10,000,000 digits,
(define a (time (expt 3 20959032))) (define b (time (expt 7 11832946))) (define c (time (expt 11 19205051)))
We compare somewhat better:
(* a b) 3.883 1.86 (quotient c a) 18.560 10.58 (integer-sqrt c) 20.096 8.65 (gcd a b) 339.918 5515.79
So now any aliasing improvements, code generation, etc., will improve the gambit times. The gmp kernels are already written in assembler.
Brad