[Ecls-list] Slow bignums

Waldek Hebisch hebisch at math.uni.wroc.pl
Mon Jan 25 03:26:53 UTC 2010


I have noticed that ecl seem to be quite slow on some bignum
operations, namely bignum addition and multiplication of
bignum by a fixnum.   Using routine at end of this message
and commands like:

(time (progn (setf *res* (expinv 100000)) nil))

I get the following times:

               100000         500000      1000000
sbcl            0.055         0.85         3.642
Closure CL      0.090599      1.683114     6.154065
gcl             0.080         0.980        3.620
ecl             0.119         2.463        8.943
clisp           0.419096      7.765847     23.6494


So only clisp is slower.  Compared to sbcl ecl is consing quite
a lot:

bits        consed       sbcl             ecl
10000                47,450,560        1407897856
500000            1,017,620,240      777071212920
1000000           3,840,454,352    15231908733112

clisp and Closure CL cons comparably to ecl (gcl does not report
consing).


(defun expinv(bits)
    "computes numerator and denominator of exp(1) via continued
fraction"
    (let* ((p0 3)
           (p1 (+ (* 6 p0) 1))
           (q0 1)
           (q1 (+ (* 6 q0) 1))
           (i 10))
      (loop
           (if (>= (* 2 (integer-length p0)) bits)
               (return-from expinv (list p1 q1)))
           (psetf p1 (+ (* i p1) p0) p0 p1)
           (psetf q1 (+ (* i q1) q0) q0 q1)
           (setf i (+ i 4)))))

-- 
                              Waldek Hebisch
hebisch at math.uni.wroc.pl 




More information about the ecl-devel mailing list