Benchmarks

• To: <info-mcl@cambridge.apple.com>
• Subject: Benchmarks
• From: Dave Lucky <76557.704@CompuServe.COM>
• Date: 07 Sep 93 22:21:50 EDT

```I'm trying to get an idea of performance of MCL vs C/C++.  I was thinking about
running some benchmark programs to give me an idea although I realize I won't
be able to say which is faster in every situation.  Does anyone know of any
good benchmarks that exist both in Common Lisp and C (or even Pascal)?

I did get ahold of a program called tak (in scheme) that looks like it tests
recursion.  The program was pretty easy to convert to C and I also ran it under
Think and MPW.  I used the Time Mgr. to measure the elapsed time (in msecs) for
the C code and the time function in MCL.  I'm assuming that the time function
is pretty accurate (like using the Time Mgr).  The MCL code:

(defun tak (x y z)
(if (not (< y x))
z
(tak (tak (- x 1) y z)
(tak (- y 1) z x)
(tak (- z 1) x y))))

I used the time function in MCL to measure the elapsed time for the Lisp
program.  I found that, without any declarations, '(TIME (TAK 18 12 6))' took
195 msecs the first time and 168 msecs afterwards on my Q950.  With
optimization declarations,

(declare (optimize (speed 3) (safety 0) (space 0)))

the first time was 114 msecs and 92 msecs afterwards.  Type declarations made
no difference here.  Maybe someone can explain why the first time is slower
than the others.

Under MPW C, the time was around 107 msecs while the Think program (same
source) was around 90 msecs.

This little test produced results that surprised me although the MCL code
should do well at this sort of recursion.  I like to take this a bit further
and see how MCL compares to C.  Afterwards, I may try to make some comparisons
with CLOS and C++.