time
can be used to determine execution times. The macro evaluates the form given to it as argument, and prints out some timing and size data: the user and system times (in seconds), the elapsed time (in hours, minutes and seconds), and the total amount of heap space allocated in executing the form (in bytes).
The timing and size data covers all stack groups, not just the one that invokes time. Note that
time
itself uses a small, constant amount of heap space.
Note:
time
measures all threads, so to test accurately for consing in your code
code
you need to do:
(without-interrupts (time
code
))
This is particularly important when using the Common LispWorks IDE.
CL-USER 33 > (time (progn (format t "start")
(dotimes (a 100) nil)
(format t "end")))
Timing the evaluation of (PROGN (FORMAT T "start") (DOTIMES (A 100) NIL) (FORMAT T "end"))
startend
User time = 0.000
System time = 0.000
Elapsed time = 0.000
Allocation = 5468 bytes
0 Page faults
Calls to %EVAL 1160
NIL