dmd codegen improvements

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 19 07:34:20 PDT 2015


On Tuesday, 18 August 2015 at 10:45:49 UTC, Walter Bright wrote:
> So if you're comparing code generated by dmd/gdc/ldc, and 
> notice something that dmd could do better at (1, 2 or 3), 
> please let me know. Often this sort of thing is low hanging 
> fruit that is fairly easily inserted into the back end.
>

I have a about 30 lines of numerical code (using real) where the 
gap is about 200%-300% between ldc/gdc and dmd (linux x86_64). In 
fact dmd -O etc is at the level of ldc/gdc without any 
optimizations and dmd without -0 is even slower.
With double instead of real the gap is about 30%.

dmd is unable to inline 3 function calls (pragma(inline, true) => 
compiler error) but for ldc disabling inlining does not really 
hurt performance.

My knowledge of asm and compiler optimizations are quite limited 
and I can't figure out what dmd could do better.

If someone is interested to investigate this, I can put the 
source + input file for the benchmark on github. Just ping me:)

Notice: I use ldc/gdc anyway for such stuff and imo the 
performance of dmd is not the most important issue with D - e.g. 
compared to C++ interface (mainly std::vector).



More information about the Digitalmars-d mailing list