How fast is D compilation compared to C++?

Patrick Schluter Patrick.Schluter at bbox.fr
Tue Sep 20 16:42:18 UTC 2022


On Tuesday, 20 September 2022 at 16:13:30 UTC, Ali Çehreli wrote:
> D's CTFE can make D compilation infinitely slow. Let's put 
> anomalous cases aside...
>
> We say D compiles much faster than C++. Does anyone have any 
> measurement or a gut feeling about the same program written in 
> idiomatic C++ vs. idiomatic D? I think it may be 30 seconds vs. 
> 5 seconds. I that a fair guess?
>
> Although a ballpark figure is good enough, precise measurements 
> would be useful as well.
>

The change in DMD from version 2.67 to 2.68 where the backend 
went from C++ to D is one example that allows a comparison. Fair 
in the sense that both backend were 1 to 1 translation but not 
really representative as no advanced C++ or D features (template, 
CDFE, etc.. were used).

Compiling DMD on our server at work using 2GHZ intel of 4th 
generation (single thread) went from a little less than 2 minutes 
for 2.67 to just a little above 8s.



More information about the Digitalmars-d mailing list