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

Deewiant deewiant.doesnotlike.spam at gmail.com
Fri Jun 9 09:13:19 PDT 2006


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_.



More information about the Digitalmars-d mailing list