<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 18 August 2015 at 12:45, Walter Bright via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Martin ran some benchmarks recently that showed that ddmd compiled with dmd was about 30% slower than when compiled with gdc/ldc. This seems to be fairly typical.<br>
<br>
I'm interested in ways to reduce that gap.<br>
<br>
There are 3 broad kinds of optimizations that compilers do:<br>
<br>
1. source translations like rewriting x*2 into x<<1, and function inlining<br>
<br>
2. instruction selection patterns like should one generate:<br>
<br>
    SETC AL<br>
    MOVZ EAX,AL<br>
<br>
or:<br>
    SBB EAX<br>
    NEG EAX<br>
<br>
3. data flow analysis optimizations like constant propagation, dead code elimination, register allocation, loop invariants, etc.<br>
<br>
Modern compilers (including dmd) do all three.<br>
<br>
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.<br>
<br>
For example, recently I improved the usage of the SETcc instructions.<br>
<br>
<a href="https://github.com/D-Programming-Language/dmd/pull/4901" rel="noreferrer" target="_blank">https://github.com/D-Programming-Language/dmd/pull/4901</a><br>
<a href="https://github.com/D-Programming-Language/dmd/pull/4904" rel="noreferrer" target="_blank">https://github.com/D-Programming-Language/dmd/pull/4904</a><br>
<br>
A while back I improved usage of BT instructions, the way switch statements were implemented, and fixed integer divide by a constant with multiply by its reciprocal.<br>
</blockquote></div><br></div><div class="gmail_extra">You didn't fix integer divide on all targets?<br><br><a href="https://issues.dlang.org/show_bug.cgi?id=14936">https://issues.dlang.org/show_bug.cgi?id=14936</a><br><br></div><div class="gmail_extra">(Consider this my contribution to your low hanging fruit)<br></div><div class="gmail_extra"><br></div></div>