If I look at the Great Compiler Language Shootout on 
shootout.alioth.debian.org, CMU CL seems to perform quite poor. at least 
in some crucial benchmarks.

See e.g. the second benchmark (array):

http://shootout.alioth.debian.org/great/benchmark.php?test=ary&lang=cmucl&id=0&sort=cpu

Certainly, as everyone on this list knowing a bit about CMU should know, 
this is only apparent performance. Indeed, CMU is much better than this, 
only some benchmarks have been written by people who do not know how to 
put proper annotations that the compiler would like to see into LISP code.

To stick with this specific example:

 N      Full CPU Time s         Memory Use KB   CPU Time s      Code Lines
9,000   0.18                    5,436           0.15            18

;;; -*- mode: lisp -*-
;;; $Id: ary-cmucl.code,v 1.5 2004/11/30 07:11:59 bfulgham Exp $
;;; http://shootout.alioth.debian.org/
;;; Multi-lisp modifications by Brent Fulgham

(defun main ()
  (let ((n (parse-integer (or (car (last #+sbcl sb-ext:*posix-argv*
                                         #+cmu  
extensions:*command-line-strings*
                                         #+gcl  si::*command-args*)) "1"))))
    (declare (fixnum n))
    (let ((x (make-array n :element-type 'fixnum))
          (y (make-array n :element-type 'fixnum))
          (last (1- n)))
      (declare (fixnum last))
      (dotimes (i n)
        (declare (fixnum i))
        (setf (aref x i) (+ i 1)))
      (dotimes (k 1000)
        (do ((i last (1- i)))
            ((< i 0) 'nil)
          (declare (fixnum i))
          (incf (aref y i) (aref x i))))
      (format t "~A ~A~%" (aref y 0) (aref y last)))))

===============================================================

My interpretation of all this:

(defun main (n)
  (declare (fixnum n))
  (let ((x (make-array n :element-type 'fixnum))
        (y (make-array n :element-type 'fixnum))
        (last (1- n)))
    (declare (fixnum last))
    (dotimes (i n)
      (declare (fixnum i))
      (setf (aref x i) (+ i 1)))
    (dotimes (k 1000)
      (do ((i last (1- i)))
          ((< i 0) 'nil)
        (declare (fixnum i))
        (incf (aref y i) (aref x i))))
    (format t "~A ~A~%" (aref y 0) (aref y last))))


(defun tf-main (n)
  (declare (optimize (safety 0) (speed 3))
           (fixnum n))
  (let ((x (make-array n :element-type 'fixnum))
        (y (make-array n :element-type 'fixnum))
        (last (1- n)))
    (declare (fixnum last)
             (type (simple-array fixnum (*)) x y))
    (dotimes (i n)
      (declare (fixnum i))
      (setf (aref x i) (the fixnum (+ i 1))))
    (dotimes (k 1000)
      (declare (fixnum k))
      (do ((i last (the fixnum (1- i))))
          ((< i 0) 'nil)
        (declare (fixnum i))
        (incf (aref y i) (aref x i))
        ))
    (format t "~A ~A~%" (aref y 0) (aref y last))))

My timings (2.533 GHz Pentium-IV notebook):

CL-USER> (time (main 9000))
; Compiling LAMBDA NIL: 
; Compiling Top-Level Form: 
1000 9000000

; Evaluation took:
;   0.14 seconds of real time
;   0.14 seconds of user run time
;   0.0 seconds of system run time
;   350,138,688 CPU cycles
;   0 page faults and
;   73,360 bytes consed.
; 
NIL

Hence, my machine is slightly faster than the one they did this benchmark 
on by a factor of approx. 1.3

CL-USER> (time (tf-main 9000))
; Compiling LAMBDA NIL: 
; Compiling Top-Level Form: 
1000 9000000

; Evaluation took:
;   0.04 seconds of real time
;   0.04 seconds of user run time
;   0.0 seconds of system run time
;   101,010,572 CPU cycles
;   0 page faults and
;   73,360 bytes consed.
; 

This would put CMUCL in the neighbourhood of Ocaml and intels C++ 
compiler, instead of Java (GCJ). From my own experience, I'd say - besides 
I/O being somewhat slow - this is rather the appropriate place to rank 
CMUCL.

Anyone else interested in going through the published benchmarks with a 
machete?

-- 
regards,               [EMAIL PROTECTED]              (o_
 Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)

Reply via email to