Some things are standard: get-internal-run-time and get-internal-real-time:
(defvar *my-timings* nil)
(let ((run (get-internal-run-time))
(real (get-internal-real-time)))
(multiple-value-prog1 (my-code)
(push (cons (- (get-internal-run-time) run)
(- (get-internal-real-time) real))
*my-timings*)))
Others are not (space and GC count), you need to find the implementation-specific versions.
You might also consider using with-timing
- it provides progress reports including ETA.
Incidentally, in your code, memory allocation (make-array
) dwarfs length
(which is slot access for an array).