It seems like DMD doesn't optimize tail recursion very well

pragma pragma_member at pathlink.com
Fri Jun 9 09:36:11 PDT 2006


In article <e6c6o2$qba$1 at digitaldaemon.com>, Deewiant says...
>
>pragma wrote:
>> Now on a whim, I added "extern(C)" to the definition of Ack() like so:
>> 
>>> extern(C) int Ack(int a, int b){ /* ... */ }
>> 
>> And got this:
>> 
>> C:\home\pragma\src\test>ackcpp.exe
>> 7371540535 clock cycles elapsed.
>> 
>> C:\home\pragma\src\test>ackd.exe
>> 7057883217 clock cycles elapsed.
>> 
>> With that change D is still lagging, but by *significantly* less - so there's
>> another factor here.
>
>Looking at your numbers, D was actually precisely 313657318 clock cycles _faster_.

Oh, my bad.  Thanks for catching that. :)

- EricAnderton at yahoo



More information about the Digitalmars-d mailing list