Denis Koroskin Wrote: > On Sun, 08 Feb 2009 18:40:53 +0300, Denis Koroskin <[email protected]> wrote: > > > On Sun, 08 Feb 2009 18:09:41 +0300, naryl <[email protected]> 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. >
Sorry. :) For n=40 I get: C++ compiled with "g++ -O fibs.cc" - 5.37s D compiled with "dmd -O -inline fibs.d" - 14.32s D compiled with "dmd -O -inline -release fibs.d" - 15.20s DMD 2.023 is still almost three times slower.
