creativelimits.net:programming/lisp-numerics/debugging/

Debugging overview

All Common Lisp implementations provide an interactive debugger. The interface to the debugger is not part of the ANSI standard so implementations will differ.

Using Trace

Richard Fateman defined the following recursive function for calculating the square root in his paper on automatic differentiation in lisp.
    (defconstant *eps* 1e-16)
    (defun sine (x)
    "Recursive sine function from Fateman 2003 paper on automatic differentation"
    (if (< (abs x) *eps*)
      x
    (let ((g (sine (/ x 3))))
      (- (* 3 g) (* 4 g g g))))) 
      
    (trace sine)
    (sine (/ pi 2))
    (untrace sine)

Profiling code

    (time (sine (* 2 pi)))
    ; Compiling LAMBDA NIL: 
    ; Compiling Top-Level Form: 

    ; Evaluation took:
    ;   0.02 seconds of real time
    ;   0.0 seconds of user run time
    ;   0.0 seconds of system run time
    ;   13,954,220 CPU cycles
    ;   8 page faults and
    ;   14,152 bytes consed.
    ; 
    1.3322676295501878d-15

More in depth information on optimizing code

The thread on comp.lang lisp about the Coyote Gulch challenge. Bill Clementson, as always, provides an excellent overview of the thread.

For a closer look at optimizing numeric code for CMUCL see this thread on the mailing list.