[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal: lua_pushfoo() should return 1
- From: Chris Emerson <chris-lua@...>
- Date: Wed, 3 Sep 2014 10:20:47 +0100
On Wed, Sep 03, 2014 at 12:45:51AM -0700, Tim Hill wrote:
> There are two advantages to tail-calls: the first is a small performance
> improvement which collapses a call/ret into a jump. The much bigger
> (potential) advantage is that it doesn’t use stack space, and this means
> that recursive functions that can take advantage of this do not run the
> risk of stack overflows.
Of course you can't actually portably take advantage of that in C, as the
standard doesn't guarantee anything, unlike in Scheme etc. So it's more of
a nice-to-have optimisation.
Chris