[Shootout-list] Re: ackermann, fibonacci and takfp benchmarks

Aaron Denney wnoise@ofb.net
Sun, 20 Mar 2005 21:50:03 +0000 (UTC)


On 2005-03-20, Daniel South <WildCard_25@HotMail.Com> wrote:
> Aaron Denney wrote:
>> On 2005-03-19, Daniel South <WildCard_25@HotMail.Com> wrote:
>> > This will of course impact the languages that had been optimising
>> > out the recursions, but the whole point is to test the cost of
>> > calling the function, not to test how well the compiler optimises.
>>
>> "The cheapest function call is one the compiler can optimize away."
>> IOW, I think it's completely valid as is.
>>
> As a test of how well a language handles recursive function calls, I 
> agree that these are good tests
>
> The text referred to in the ackermann benchmark, however, lead one to 
> believe that it is a test of function call overhead.

In use, function call performance does depend on how much the compiler
can optimize away.  This doesn't change much with recursive function
calls vs non-recursive.

I think you're trying to make a distinction here that doesn't exist.
Recursive function calls, if anything are harder to optimize than
non-recursive, as one can't simply inline forever.

One could, for example have a test that called 1 function N times in a
loop.  But that would just be inlined by a smart compiler (though one
can try compiler-specific tricks to disable this, but then one isn't
testing normal use).  Second try would be to have function 1 calling
function 2 calling function 3 ... and so forth to function 10000, say.
Defining that many functions seems a bit silly, and _really_ bloats the
LOC count, and may not even work.  The same holds for trivial
variations, such as calling multiple times per function, creating a
tree-structure that is traversed, rather than linear.  That pretty much
leaves recursive function calls.

A better distinction might be between tail-calls and non-tail calls, as
tail-calls need not save the stack (except for debugging or 
performance logging purposes), and of course when using recursive
function calls, one often wants them to be tail-calls, which leads to 
some terminology confusions.

The Ackermann benchmark now has "Integer recursive function performance."
as it's description on the main page.  Good enough?

-- 
Aaron Denney
-><-