23.03.2013 Views

Performance and Evaluation of Lisp Systems - Dreamsongs

Performance and Evaluation of Lisp Systems - Dreamsongs

Performance and Evaluation of Lisp Systems - Dreamsongs

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

82<br />

little else but function calls (fixnum arithmetic is performed as well), it is not<br />

representative <strong>of</strong> the majority <strong>of</strong> <strong>Lisp</strong> programs. It is only a good test <strong>of</strong> function<br />

call <strong>and</strong> recursion, in particular.<br />

3.1.1 The Program<br />

Here is the code for this program:<br />

(defun tak (x y z)<br />

(if (not (< y x))<br />

z<br />

(tak (tak (1- x) y z)<br />

(tak (1- y) z x)<br />

(tak (1- z) x y))))<br />

We call this function as<br />

(tak 18 12 6)<br />

3.1.2 Analysis<br />

When called on the above arguments, TAK makes 63,609 function calls <strong>and</strong><br />

performs 47,706 subtractions by 1. The result <strong>of</strong> the function is 7. The depth<br />

<strong>of</strong> recursion is never greater than 18. No garbage collection takes place in the<br />

Mac<strong>Lisp</strong> version <strong>of</strong> this function because small fixnums are used.<br />

The following table is typical <strong>of</strong> the tables that will be used to report the<br />

numbers <strong>of</strong> significant <strong>Lisp</strong>-level operations performed by the benchmark. The<br />

previous paragraph <strong>and</strong> the following table convey the same information:<br />

Meter for Tak<br />

Item Count<br />

Calls to TAK 63609<br />

1−’s 47706<br />

Total 111315<br />

circulation. Because it was simple <strong>and</strong> because there were many results for it in the literature,<br />

he felt that it would be a good initial test. Of course, John misremembered the function. But<br />

we did not realize it until I had gathered a great many numbers for it. Alas, we are stuck with<br />

this variant on Takeuchi.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!