penalty for proper tail recursion

Richard Uhtenwoldt
Sun, 04 Nov 2001 14:06:35 -0800

What is the penalty that compilers pay these days for allowing 
"proper" tail-recursion (that does not grow the stack)?  

It used to be that implementations targetting C would use 
    while (1) {cont=(*cont)();}

trick, which would lose a factor of 2 or so in speed IIRC.

If the compiler generates native code, then the penalty I believe
consists mainly of the "opportunity cost" of not targetting C and thus
not being able to piggyback on GCC development efforts, but there may be
costs which I'm failing to visualize from the fact that the hardware is
specialized to handle the conventional way of iterating (ie, structured
looping constructs).

Please share answers for other languages like Mercury, even
though some might think it slightly off-topic...