Re: Why are intepreters so slow today

Lawrence G. Mayka (
Thu, 21 Apr 1994 14:42:49 GMT

In article <> (Lawrence G. Mayka) writes:

I then compiled and ran the following on a Common Lisp implementation
on that same Sparc LX:

(defun my-float-loop-double ()
(declare (optimize (speed 3) (safety 0) (debug 0) (space 0)))
(do ((i 0 (the fixnum (1+ i)))
(x 0d0 (the double-float (+ 1d0 x))))
((>= i 1000000) x)
(declare (fixnum i) (double-float x))))

The user time was 0.23 sec. The Common Lisp code was close to three
times faster! The function returns the correct value, and its
disassembly includes the telltale "add.d %f30,%f28,%f30", branch
instructions, etc., so it's not optimizing away the loop.

Small update: The slightly modified function below completes in only
0.15 sec. An analogous modification to the C program had no effect.

(defun my-float-loop-double-faster ()
(declare (optimize (speed 3) (safety 0) (debug 0) (space 0)))
(let ((y 1d0))
(declare (double-float y))
(do ((i 0 (the fixnum (1+ i)))
(x 0d0 (the double-float (+ y x))))
((>= i 1000000) x)
(declare (fixnum i) (double-float x)))))

        Lawrence G. Mayka
        AT&T Bell Laboratories

Standard disclaimer.