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 06:00:21 PST 2013
On 02/13/2013 02:26 PM, Marco Leise wrote:
> I compiled with LDC2 and these are the results:
>
> D code serial with dimension 32768 ...
> using floats Total time: 13.399 [sec]
> using doubles Total time: 9.429 [sec]
> using reals Total time: 8.909 [sec] // <- !!!
>
> You get both, 50% more speed and more precision!
Compiling with ldmd2 -O -inline -release on 64-bit Ubuntu, latest from-GitHub
LDC, LLVM 3.2:
D code serial with dimension 32768 ...
using floats Total time: 4.751 [sec]
using doubles Total time: 4.362 [sec]
using reals Total time: 5.95 [sec]
Using double is indeed marginally faster than float, but real is slower than both.
What's disturbing is that when compiled instead with gdmd -O -inline -release
the code is dramatically slower:
D code serial with dimension 32768 ...
using floats Total time: 22.108 [sec]
using doubles Total time: 21.203 [sec]
using reals Total time: 23.717 [sec]
It's the first time I've encountered such a dramatic difference between GDC and
LDC, and I'm wondering whether it's down to a bug or some change between D
releases 2.060 and 2.061.
More information about the Digitalmars-d-learn
mailing list