DMD backend quality (Was: Re: DIP 1031--Deprecate Brace-Style Struct Initializers--Community Review Round 1 Discussion)

kinke noone at nowhere.com
Tue Feb 18 20:10:57 UTC 2020


On Tuesday, 18 February 2020 at 18:50:44 UTC, matheus wrote:
> On Sunday, 16 February 2020 at 00:16:24 UTC, H. S. Teoh wrote:
>> Unfortunately, the GDC and LDC optimizers consistently produce 
>> code that outperforms code generated by the DMD backend by 
>> 20-30%, sometimes as high as 40% for CPU-intensive code...
>
> Well these numbers are huge, I never thought the difference 
> would be higher than 10% between these compilers, thanks for 
> pointing this out.

Once you know that the DMD backend is a formidable one-man 
project, it should be clear as day that that cannot compete with 
huge eco-systems like LLVM and GCC with millions of man-hours, in 
terms of architecture support, optimizations and flexibility. 
It's nice for fast unoptimized codegen if you are only targeting 
x86, and probably features better debuginfos than LDC at the 
moment (well, ecept for Mac apparently), but to me, the DMD 
*backend* is clearly a dead end in the long run.

DMD itself runs faster by 58% when compiled with LDC for a random 
compilation test case, see 
https://github.com/dlang/installer/pull/425#issuecomment-580868218. For number crunching, you can definitely expect much higher speed-ups if the auto-vectorizer kicks in. Whole-program optimization via LTO, even across C(++) and D, and PGO can improve your runtime further.

On Tuesday, 18 February 2020 at 15:30:57 UTC, jxel wrote:
> The problem is that efforts are divided as a result.

As others have stated, that's not true. The vast majority of 
contributions to the dmd repo affect the front-end and thus 
implicitly benefit all compilers.


More information about the Digitalmars-d mailing list