Performance dmd vs ldc2

Chris wendlec at
Wed Jul 24 03:05:16 PDT 2013

I recompiled a medium sized project with ldc2 (for the first time 
ever). I was surprised at how fast the program started 
afterwards. My program reads in a few rule files it needs to 
operate (including XML parsing). With dmd 2.063 the program takes 
4 seconds to load, with ldc2 it is there immediately.

Although I have not done any serious (i.e. exact) benchmarking 
here are the first obvious results:

Build time
dmd 2.063 : ~ 1 sec (probably less)
ldc2 : 14 secs

File size of executable
dmd 2.063 : 2.8 MB
ldc2 : 3.2 MB

Startup time
dmd 2.063 : 4 secs
ldc2 : next to zero secs (true!)

The program uses external C libraries (portaudio and libsndfile 
among others). However, the performance gain when using ldc2 is 
in the reading and parsing part of the program, which is pure D 

By the way, the program compiled with ldc2 without error at the 
first attempt. No complaints, no questions asked :-)

PS Naive question: What's the difference between ldc2 and ldmd2?

More information about the digitalmars-d-ldc mailing list