Woeful performance of D compared to C++

Pragma ericanderton at yahoo.removeme.com
Thu Jan 18 12:43:59 PST 2007


rael at seesig.com wrote:
> In other benchmarks I've seen, D seems quite competitive with C/C++.
> 
> I seem to have written a very simple program that shows D in a very
> poor light compared to C++.  I wonder if it is my inexperience.
[snip]
> Any help would be appreciated.

I'm gobsmacked.  No array concatenation, strings, large allocations, or even floating point.  Just integer math and 
comparisons.

Check the obvious stuff first: disable the GC, compile with "-inline -release" for GDC to match the "-O3 -o" that you're 
using on GCC.

The only part of that loop that is of any consequence is the call to rand() - odds are they are two completely different 
algorithms, with D's being slower (performance test anyone?).  Everything else should reduce to almost the same exact 
machine code.

-- 
- EricAnderton at yahoo



More information about the Digitalmars-d mailing list