Finding large difference b/w execution time of c++ and D codes for same problem

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Feb 13 07:14:23 PST 2013


On 02/13/2013 03:56 PM, Marco Leise wrote:
> Ok, I get pretty much the same numbers as before with:
>    ldmd2 -O -inline -release
> It's even a bit faster than my loooong command line.

My experience has been that the higher -O values of ldc don't do much, but of 
course, that's going to vary depending on your code.  I think above -O3 it's all 
link-time, no?

> Do these numbers tell us, that there are such huge differences
> in the handling of floating point value between different
> AMD64 CPUs? I can't quite make a rhyme of it yet.

AMD vs Intel might make a difference (my machine is an i7).

> What version of LLVM are you using, mine is 3.1. 3.0 is
> minimum and 3.2 is recommended for LDC2.

LLVM 3.2.

> _THAT_ I can reproduce with GDC! :
>
> D code serial with dimension 32768 ...
>    using floats Total time: 24.415 [sec]
>    using doubles Total time: 23.268 [sec]
>    using reals Total time: 25.168 [sec]
>
> It's the exact same pattern.

I've never, EVER had ldc-compiled code run four times faster than GDC-compiled 
code.  In fact, I don't think I've ever had LDC-compiled code run faster than 
GDC-compiled code at all, except where the choice of optimizations was 
different.  That's what makes me concerned that there's some kind of bug in play 
here ....



More information about the Digitalmars-d-learn mailing list