Old problem with performance

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Feb 8 08:34:00 PST 2009


Denis Koroskin wrote:
> On Sun, 08 Feb 2009 18:40:53 +0300, Denis Koroskin <2korden at gmail.com> 
> wrote:
> 
>> On Sun, 08 Feb 2009 18:09:41 +0300, naryl <cy at ngs.ru> wrote:
>>
>>> It's a bit offtopic but I'd be grateful if someone can explain why D 
>>> with structs completes this simple benchmark (see attachment) so 
>>> slowly compared to C++ with classes on stack:
>>>
>>> D struct - 27.85s
>>> C++ stack - 8.32s
>>>
>>> D class - 271.58s
>>> C++ heap - 249.32s
>>>
>>> Compiled with "dmd -O". -release decreases performance by 10% in this 
>>> case. -inline doesn't affects it at all.
>>
>> I noticed that you calculate Fib(27) in fibs.cc and Fib(40) in fibs.d
>> Can this affect such a big difference between C++ and D version?
>>
> 
> They both perform roughly the same when this typo is corrected.
> 

It was a ploy! :o)

Andrei



More information about the Digitalmars-d mailing list