Programming language benchmark

Timon Gehr timon.gehr at gmx.ch
Sun Jun 26 14:14:13 PDT 2011


Don wrote:
> bearophile wrote:
>> Don:
>>
>> Sorry for my slow answer, I was quite busy for days.
>>
>>
>>> I've never heard that claim before. Do you have evidence for that?
>>
>> I compare/convert code to D every day, so I am aware that D code compiled with
DMD is often slower than C/C++ code compiled with GCC. Since some years I even keep a
>> collection of snippets of slow code.
>>
>> But I am also aware that the low performance has many different causes, like
some missing inlining, missing loop unrolling, etc, so spotting a clear and small
case of
> integer arithmetic code that causes a slow down, to give you evidence, is not
easy. So I am sorry for my overly broad claim.
>
> It is true in general that DMD's inliner is not very good. I _suspect_
> that it is the primary cause of most instances of poor integer
> performance. It's actually part of the front-end, not the back-end. So
> many of those performance problems won't apply to DMC.
>
> It's also true that the DMD/DMC instruction scheduler doesn't schedule
> for modern processors. But last I checked, GCC wasn't really much better
> in practice (you have to be almost perfect to get a benefit from
> instruction scheduling these days, the hardware does a very good job on
> unscheduled code).
>
> Otherwise, I don't think there's any major optimisation it misses. But
> it's quite likely that it misses several very specific minor optimizations.
>
>>> If it is true, there's a strong possibility that it's a small, fixable issue
(for example, DMD used to have terrible performance for ulong multiplication).<
>>
>> You are right, the case I'm going to show is a precise problem that's fixable.
>
> [snip]
>> -----------------------
>>
>> For a more real case see:
>> http://d.puremagic.com/issues/show_bug.cgi?id=5607
>
>
> Thanks, that's helpful. It's a major speed difference (factor of 20,
> maybe) so it wouldn't have to occur very often to be noticeable.

You may also want to have a look at this paper:

http://www.agner.org/optimize/optimizing_cpp.pdf

I don't know if it still accurately reflects the current state though.
Interestingly, it says that DMC is already able to perform the optimization
requested by bearophile.

On page 73 starts a tabular that is quite specific about which optimizations the
DMC backend is lacking.

Cheers,
-Timon


More information about the Digitalmars-d mailing list