D for scientific computing

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Jan 24 16:02:34 PST 2013


On 01/24/2013 10:05 PM, Rob T wrote:
> You are taking care to compare with full optimization flag settings? I'm sure
> you are, but I ask just in case.

I use -O -release -inline typically (I use the dmd-ish interfaces for gdc and 
ldc as well).

Absent any optimizations, executables seem to run at about the same speed no 
matter what compiler is used.  Interestingly, at least on the code that I just 
tested with, the different compilers react differently to different 
optimizations: dmd gains much less from -O than gdmd, and ldmd2 gains much more 
than both of the others.  Adding -inline doesn't seem to affect executable speed 
at all (this is probably a quirk of the particular code I'm testing with). 
Adding -release speeds up executables about as much as -O (for dmd and gdmd) and 
maybe makes a slight additional speedup for ldmd2.

With -O -release -inline, executables compiled with gdmd and ldmd2 seem to run 
at about the same speed.  Interestingly, using -release alone results in about 
the same executable speed for both gdmd and ldmd2, but using -O alone means 
ldmd2-compiled executables are as fast as gdmd-compiled executables compiled 
with both -O and -release.

That surely means that these identical DFLAGS translate in practice into 
different underlying optimizations depending on the compiler.

Of course, these are very casual and trivial tests using a single piece of code 
-- here if you want to repeat the tests: https://github.com/WebDrake/Dregs -- 
but they reflect my typical experience with the different D compilers.


More information about the Digitalmars-d mailing list