How to best translate this C++ algorithm into D?

Joseph Rushton Wakeling via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 8 08:03:12 PDT 2014


On 08/06/14 10:18, logicchains via Digitalmars-d wrote:
> It's still slightly less than half the speed of the C++ version, but I'm out of
> ideas now. I thought the C++ version might be vectorised but I checked the
> objdump and it wasn't, and I made an attempt at vectorising the D version, via
> inline SSE, but that didn't turn out to be significantly faster.

What compiler are you using?

DMD will in general produce slower executables than LDC or GDC -- about half as 
fast sounds quite plausible.  If your C++ code is compiled with gcc or clang, 
you're not doing a fair comparison.

If you haven't already, try compiling with LDC or GDC, with full-on -O -release 
-inline -noboundscheck options, and see how that compares with the C++ code.


More information about the Digitalmars-d mailing list