Study: build times for D programs

Jonathan M Davis jmdavisProg at gmx.com
Thu Jul 26 11:59:00 PDT 2012


On Thursday, July 26, 2012 18:00:21 Joseph Rushton Wakeling wrote:
> On 26/07/12 15:42, Andrei Alexandrescu wrote:
> >> If you can advise some flag combinations (for D and C++) you'd like to
> >> see tested, I'll happily do them.
> > 
> > The classic to ones are: (a) no flags at all, (b) -O -release -inline, (c)
> > -O -release -inline -noboundscheck.
> 
> Here's a little table of DMD to GDC comparisons for the Dregs codebase:
> 
>                      ----------DMD----------    ----------GDC----------
> compiler flags       compile time    runtime    compile time    runtime
> -O -release -inline      0.43s           52s        1.51s           25s
> -O -release              0.35s           47s        1.50s           25s
> -O -noboundscheck        0.35s           56s        1.66s           25s
> -O -inline               0.47s        1m  5s        1.94s           45s
> -O                       0.36s        1m  5s        1.98s           45s
> -release -inline         0.31s        1m  3s        0.63s        1m  3s
> -release                 0.29s        1m  3s        0.63s        1m  3s
> -inline                  0.32s        1m 24s        0.70s        1m 26s
> -noboundscheck           0.29s        1m 10s        0.666s       1m  9s
> [none]                   0.29s        1m 24s        0.72s        1m 26s
> -debug                   0.30s        1m 24s        0.70s        1m 26s
> -unittest                0.42s        1m 25s        0.75s        1m 26s
> -debug -unittest         0.42s        1m 25s        0.78s        1m 26s

Clearly -O is where the big runtime speed difference is at between dmd and gdc, 
which _is_ a bit obvious, but I'm surprised that -inline had no differences, 
since dmd is generally accused at being poor at inlining. That probably just 
indicates that it's a frontend issue (which I suppose makes sense when I think 
about it).

I guess that the way to go if you want to maxize both your efficiency and the 
code's efficiency is to do most of the coding with dmd but generate the final 
program with gdc (though obviously building and testing with both the whole 
way is probably necessary to ensure stability; still much of that could be 
automated and not affect programmer efficiency).

- Jonathan M Davis


More information about the Digitalmars-d mailing list