Study: build times for D programs

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Tue Jul 24 16:54:46 PDT 2012


On 24/07/12 15:34, Andrei Alexandrescu wrote:
> One idea would be to take a real, non-trivial application, written in both D and
> another compiled language. We then can measure build times for both
> applications, and also measure the relative speeds of the generated executables.

Suggest that this gets done with all 3 of the main D compilers, not just DMD. 
I'd like to see the tradeoff between compilation speed and executable speed that 
one gets between them.

I do have some pretty much equivalent simulation code written in both D and C++. 
  For a rough comparison:

    Language     Compiler        Compile time (s)        Runtime (s)
      D            GDC              1.5                    25.3
      D            DMD              0.4                    52.1
      C++          g++              2.3                    21.8
      C++          Clang++          1.8                    27.6

DMD used is a fairly recent pull from GitHub; GDC is the 4.6.3 package found in 
Ubuntu 12.04.  I don't have a working LDC2 compiler on my system. :-(

The C++ has a template-based policy class design, while the D code uses template 
mixins to similar effect.  The D code can be found here:
https://github.com/WebDrake/Dregs

While I'm happy to also share the C++ code, I confess I'm shy to do so given 
that it probably represents a travesty of the beautiful ideas Andrei developed 
on policy class design ... :-)

Best wishes,

     -- Joe


More information about the Digitalmars-d mailing list