Gerd Moellmann <[EMAIL PROTECTED]> writes:

> Another data point: The code below, which is my personal direct
> translation of the C code, takes 0.5s to run (x86 P4 box, CMUCL from
> CVS. FreeBSD -STABLE).  The C version, compiled with GCC 2.95.4 takes
> 0.43s.
> 
> (defun test2 ()
>   (let* ((n 1000)
>        (mat (make-array (* n n) :element-type 'double-float
>                         :initial-element 1.0d0)))
>     (declare (type (simple-array double-float (*)) mat)
>            (fixnum n)
>            (optimize (speed 3) (debug 0) (safety 0)))
>     (loop for i of-type fixnum below 10 do
>           (loop for pos1 of-type fixnum from 1 below (1- n) do
>                   (loop for pos2 of-type fixnum from (+ pos1 n)
>                         below (the fixnum (+ pos1 (the fixnum (* (the fixnum (1- n)) 
>n))))
>                         by n do
>                           (let ((a0 (aref mat (the fixnum (- pos2 1001))))
>                                 (a1 (aref mat (the fixnum (- pos2 1))))
>                                 (a2 (aref mat (the fixnum (+ pos2 999))))
>                                 (a3 (aref mat (the fixnum (- pos2 1000))))
>                                 (a4 (aref mat (the fixnum (- pos2 0))))
>                                 (a5 (aref mat (the fixnum (+ pos2 1000))))
>                                 (a6 (aref mat (the fixnum (- pos2 999))))
>                                 (a7 (aref mat (the fixnum (+ pos2 1))))
>                                 (a8 (aref mat (the fixnum (+ pos2 1001)))))
>                             (setf (aref mat pos2)
>                                   (* 0.1111111111d0
>                                      (+ a0 a1 a2 a3 a4 a5 a6 a7 a8)))))))))

Thank you very much, Gerd, and thanks also to all others who
responded.  This really helps me alot, because I want to give the
argument of custom code generation for an important case at a talk on
a conference next week.  (Of course, I'll also mention CMUCL and its
informative mailing list then.)

Yours, Nicolas.


Reply via email to