next up previous
Next: Poor Knowledge of the Up: Good Lisp Programming is Previous: Good Lisp Programming is

Bad Declarations

This example is a mistake that is easy to make. The programmer here did not declare his arrays as fully as he could have. Therefore, each array access was about as slow as a function call when it should have been a few instructions. The original declaration was as follows:

(proclaim '(type (array fixnum *) *ar1* *ar2* *ar3*))

The three arrays happen to be of fixed size, which is reflected in the following correct declaration:

(proclaim '(type (simple-array fixnum (4)) *ar1*))
(proclaim '(type (simple-array fixnum (4 4)) *ar2*))
(proclaim '(type (simple-array fixnum (4 4 4)) *ar3*))

Altering the faulty declaration improved the performance of the entire system by 20%.



Timothy Finin
Mon Jan 6 21:25:50 EST 1997