Forum: Editorial


Edit history: 2004-12-14, Version 1 by Paul Dietz

Status: For CLiki consideration

Problem Description:

The description of the TIME macro makes it unclear if the macro is expected to print when execution of the form is over, or only if the form terminates normally returning zero or more values. Also, it is unclear if the same kind of information must be provided by the macro in all executions.


Specify that the information printed by TIME has the same format and content regardless of how the enclosed form terminates, and that the printing occurs when control is transfered from the form by normal return or non-local transfer of control (which does not include conditions until the stack is unwound.)

Test case:

(let ((s (with-output-to-string
	     (block done
	       (time (return-from done nil))))))
    (= (length s) 0))
==> NIL


There is otherwise no good way to time forms that performance nonlocal transfers of control.

Current practice:

Some lisps (Lispworks, CLISP) satisfy the new proposal. Others (CMUCL, SBCL, Allegro CL, GCL) do not print in this situation.

Cost to Implementors:

Duane Rettig argues that the change will cause an unacceptable performance perturbation due to the effects of the required UNWIND-PROTECT on the compilation of the enclosed form, or the effects of enclosing the form in a lambda expression to be passed to an internal function implementing the timing.

Cost to Users:

Possible loss of accuracy when timing compiled TIME forms due to perturbation of the code generated by the compiler.

Cost of Non-Adoption:

Inconsistency of implementations.


Improved consistency and ability to time forms that perform arbitrary nonlocal transfers of control.



  • Duane Rettig has objected strongly to a test reflecting the proposed behavior.

This page is presently Uncategorized: please add appropriate topic markers and remove this text