hai
...@ilog.fr writes:
> Espen Vestre:
> > > precision integers, like all other Common Lisp implementation (but
> > > faster than the other bignum implementations :-)).
> > ...did you compare with MCL?
> No, I don't have access to the platforms MCL runs on.
> If someone could take and publish benchmarks. The following list of
> operations is a good benchmark for bignum operations. Please post the
> MCL timings.
OK, here they are:
This is for MCL 4.3.1 running on a 300 MHz PowerPC G3 (beige).
Compiler options set via
(declaim (optimize (speed 3) (safety 0) (space 0) (debug 0)))
> A. Elementary integer computations:
> The tests are run with N = 100, 1000, 10000, 100000 decimal digits.
> Precompute x1 = floor((sqrt(5)+1)/2 * 10^(2N))
> x2 = floor(sqrt(3) * 10^N)
> x3 = 10^N+1
> Then time the following operations:
> 1. Multiplication x1*x2,
> 2. Division (with remainder) x1 / x2,
> 3. integer_sqrt(x3),
> 4. gcd(x1,x2),
> B. (from Pari)
> u=1;v=1;p=1;q=1;for(k=1..1000){w=u+v;u=v;v=w;p=p*w;q=lcm(q,w);}
================================================================
Short form:
100 1000 10000 100000
A.1 0.021 1.6 153 16900 ms
0.13 1.3 12.4 125 x 10^3 bytes allocated
A.2 0.042 1.2 99 10450 ms
0.10 0.9 20.8 208 x 10^3 bytes allocated
A.3 0.18 1.37 65 6280 ms
0.68 4.9 52.4 757 x 10^3 bytes allocated
A.4 1.7 42.5 3257 443000 ms
5.8 414.5 43512 11991249 x 10^3 bytes allocated
100 200 1000
B. 14.5 118 2150 ms
4592 3280 51996 x 10^3 bytes allocated
================================================================
Long form:
(integer-benchmark)
N = 100, Multiplication x1*x2, divide times by 10000
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 207 milliseconds (0.207 seconds) to run.
Of that, 1 milliseconds (0.001 seconds) were spent in The Cooperative Multitasking Experience.
1,360,000 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 219 milliseconds (0.219 seconds) to run.
Of that, 6 milliseconds (0.006 seconds) were spent in The Cooperative Multitasking Experience.
1,360,016 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 216 milliseconds (0.216 seconds) to run.
Of that, 3 milliseconds (0.003 seconds) were spent in The Cooperative Multitasking Experience.
1,360,024 bytes of memory allocated.
N = 100, Division (with remainder) x1 / x2, divide times by 10000
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 427 milliseconds (0.427 seconds) to run.
Of that, 9 milliseconds (0.009 seconds) were spent in The Cooperative Multitasking Experience.
1,040,016 bytes of memory allocated.
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 505 milliseconds (0.505 seconds) to run.
Of that, 83 milliseconds (0.083 seconds) were spent in The Cooperative Multitasking Experience.
1,040,024 bytes of memory allocated.
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 467 milliseconds (0.467 seconds) to run.
Of that, 44 milliseconds (0.044 seconds) were spent in The Cooperative Multitasking Experience.
1,040,040 bytes of memory allocated.
N = 100, integer_sqrt(x3), divide times by 10000
(DOTIMES (_ REPEAT) (SETQ Y (ISQRT X3))) took 2,179 milliseconds (2.179 seconds) to run.
Of that, 94 milliseconds (0.094 seconds) were spent in The Cooperative Multitasking Experience.
201 milliseconds (0.201 seconds) was spent in GC.
6,880,224 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (ISQRT X3))) took 1,956 milliseconds (1.956 seconds) to run.
Of that, 103 milliseconds (0.103 seconds) were spent in The Cooperative Multitasking Experience.
6,880,120 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (ISQRT X3))) took 1,990 milliseconds (1.990 seconds) to run.
Of that, 137 milliseconds (0.137 seconds) were spent in The Cooperative Multitasking Experience.
6,880,120 bytes of memory allocated.
N = 100, gcd(x1,x2), divide times by 10000
(DOTIMES (_ REPEAT) (SETQ Y (GCD X1 X2))) took 17,982 milliseconds (17.982 seconds) to run.
Of that, 964 milliseconds (0.964 seconds) were spent in The Cooperative Multitasking Experience.
364 milliseconds (0.364 seconds) was spent in GC.
57,681,848 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (GCD X1 X2))) took 17,818 milliseconds (17.818 seconds) to run.
Of that, 1,008 milliseconds (1.008 seconds) were spent in The Cooperative Multitasking Experience.
183 milliseconds (0.183 seconds) was spent in GC.
57,681,032 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (GCD X1 X2))) took 18,018 milliseconds (18.018 seconds) to run.
Of that, 1,020 milliseconds (1.020 seconds) were spent in The Cooperative Multitasking Experience.
364 milliseconds (0.364 seconds) was spent in GC.
57,681,032 bytes of memory allocated.
N = 1000, Multiplication x1*x2, divide times by 1000
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 1,673 milliseconds (1.673 seconds) to run.
Of that, 78 milliseconds (0.078 seconds) were spent in The Cooperative Multitasking Experience.
1,256,144 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 1,680 milliseconds (1.680 seconds) to run.
Of that, 97 milliseconds (0.097 seconds) were spent in The Cooperative Multitasking Experience.
1,256,144 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 1,720 milliseconds (1.720 seconds) to run.
Of that, 134 milliseconds (0.134 seconds) were spent in The Cooperative Multitasking Experience.
1,256,184 bytes of memory allocated.
N = 1000, Division (with remainder) x1 / x2, divide times by 1000
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 1,262 milliseconds (1.262 seconds) to run.
Of that, 39 milliseconds (0.039 seconds) were spent in The Cooperative Multitasking Experience.
856,112 bytes of memory allocated.
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 1,318 milliseconds (1.318 seconds) to run.
Of that, 97 milliseconds (0.097 seconds) were spent in The Cooperative Multitasking Experience.
856,144 bytes of memory allocated.
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 1,345 milliseconds (1.345 seconds) to run.
Of that, 125 milliseconds (0.125 seconds) were spent in The Cooperative Multitasking Experience.
856,144 bytes of memory allocated.
N = 1000, integer_sqrt(x3), divide times by 1000
(DOTIMES (_ REPEAT) (SETQ Y (ISQRT X3))) took 1,388 milliseconds (1.388 seconds) to run.
Of that, 14 milliseconds (0.014 seconds) were spent in The Cooperative Multitasking Experience.
4,896,144 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (ISQRT X3))) took 1,455 milliseconds (1.455 seconds) to run.
Of that, 80 milliseconds (0.080 seconds) were spent in The Cooperative Multitasking Experience.
4,896,144 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (ISQRT X3))) took 1,467 milliseconds (1.467 seconds) to run.
Of that, 90 milliseconds (0.090 seconds) were spent in The Cooperative Multitasking Experience.
4,896,176 bytes of memory allocated.
N = 1000, gcd(x1,x2), divide times by 1000
(DOTIMES (_ REPEAT) (SETQ Y (GCD X1 X2))) took 45,314 milliseconds (45.314 seconds) to run.
Of that, 2,742 milliseconds (2.742 seconds) were spent in The Cooperative Multitasking Experience.
2,187 milliseconds (2.187 seconds) was spent in GC.
414,468,680 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (GCD X1 X2))) took 44,829 milliseconds (44.829 seconds) to run.
Of that, 2,441 milliseconds (2.441 seconds) were spent in The Cooperative Multitasking Experience.
1,999 milliseconds (1.999 seconds) was spent in GC.
414,468,632 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (GCD X1 X2))) took 45,030 milliseconds (45.030 seconds) to run.
Of that, 2,469 milliseconds (2.469 seconds) were spent in The Cooperative Multitasking Experience.
2,190 milliseconds (2.190 seconds) was spent in GC.
414,468,672 bytes of memory allocated.
N = 10000, Multiplication x1*x2, divide times by 10
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 1,579 milliseconds (1.579 seconds) to run.
Of that, 48 milliseconds (0.048 seconds) were spent in The Cooperative Multitasking Experience.
124,808 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 1,599 milliseconds (1.599 seconds) to run.
Of that, 68 milliseconds (0.068 seconds) were spent in The Cooperative Multitasking Experience.
124,832 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (* X1 X2))) took 1,601 milliseconds (1.601 seconds) to run.
Of that, 61 milliseconds (0.061 seconds) were spent in The Cooperative Multitasking Experience.
124,872 bytes of memory allocated.
N = 10000, Division (with remainder) x1 / x2, divide times by 10
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 1,112 milliseconds (1.112 seconds) to run.
Of that, 125 milliseconds (0.125 seconds) were spent in The Cooperative Multitasking Experience.
208,280 bytes of memory allocated.
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 997 milliseconds (0.997 seconds) to run.
Of that, 10 milliseconds (0.010 seconds) were spent in The Cooperative Multitasking Experience.
208,272 bytes of memory allocated.
(DOTIMES (_ REPEAT) (MULTIPLE-VALUE-SETQ (Y Z) (FLOOR X1 X2))) took 1,045 milliseconds (1.045 seconds) to run.
Of that, 54 milliseconds (0.054 seconds) were spent in The Cooperative Multitasking Experience.
208,280 bytes of memory allocated.
N = 10000, integer_sqrt(x3), divide times by 10
(DOTIMES (_ REPEAT) (SETQ Y (ISQRT X3))) took 668 milliseconds (0.668 seconds) to run.
Of that, 21 milliseconds (0.021 seconds) were spent in The Cooperative Multitasking Experience.
524,000 bytes of memory allocated.
(DOTIMES (_ REPEAT) (SETQ Y (ISQRT X3))) took 700 milliseconds (0.700 seconds) to run.
Of that, 51 milliseconds (0.051 seconds) were spent in The Cooperative Multitasking Experience.
524,000 bytes
...