Finding large difference b/w execution time of c++ and D codes for same problem
Marco Leise
Marco.Leise at gmx.de
Wed Feb 13 06:56:55 PST 2013
Am Wed, 13 Feb 2013 15:00:21 +0100
schrieb Joseph Rushton Wakeling <joseph.wakeling at webdrake.net>:
> 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]
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.
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.
What version of LLVM are you using, mine is 3.1. 3.0 is
minimum and 3.2 is recommended for LDC2.
> 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.
_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.
--
Marco
More information about the Digitalmars-d-learn
mailing list