> The five minute work of optimizing WITH-RECURSIVE-LOCK for the case when
> the current thread already has the lock quickly turned into confusion
> (reading annotation 3 is enough):
> The executive summary is this: in the example, wrapping the same code in
> a function makes the program faster if the function is not inlined.
Unless I'm grossly misunderstanding something, there's no inlining
going on in your example regardless of which definition of FOO is
used. The difference between the two cases is that one gets tail-call
optimized, the other doesn't.
Surprisingly the one that doesn't get optimized is the one where the
compiler has access to more information. For some reason
FLUSH-FULL-CALL-TAIL-TRANSFER explicitly forbids tail-calls to
functions when the return convention isn't :UNKNOWN.