Basic benchmark

Fawzi Mohamed fmohamed at mac.com
Sat Dec 13 10:25:09 PST 2008


On 2008-12-13 19:07:09 +0100, "Jarrett Billingsley" 
<jarrett.billingsley at gmail.com> said:

> On Sat, Dec 13, 2008 at 12:55 PM, Jason House
> <jason.james.house at gmail.com> wrote:
>> Jarrett Billingsley wrote:
>> 
>>> I hope bearophile will eventually understand that DMD is not good at
>>> optimizing code, and so comparing its output to GCC's is ultimately
>>> meaningless.
>> 
>> Personally, I appreciate seeing this stuff from bearophile.  I use D in 
>> ways where speed really does count.  One of my draws to D was that it 
>> was a systems language that could be faster than something like Java.  
>> I also was sick of C++ and its problems, such as code that requires 
>> workarounds for compiler bugs or lack of compiler optimization.  It's 
>> really sad to see D requiring the same kind of stuff.  For D to become 
>> as mainstream as C++, all of this stuff that bearophile posts must be 
>> fixed.
>> 
> 
> Walter is the only one who can make DMD faster, and I think his time
> is much better spent on designing and maintaining the language.  The
> reference compiler is just supposed to be _correct_, not necessarily
> _fast_.  If Walter spent all his time working on making the the DMDFE
> optimizer better and making DMD backend produce faster code, he
> wouldn't have time to work on the language anymore, and it would be
> duplicated effort since GDC and LDC already do it better.

I fully agree, and it is not that DMD is necessarily slow, but does not 
perform some kinds of optimizations.
For example for the nested loops it does not float the operations out 
of the internal loop to as high up as possible.
I would like for this to be the case (for example my multidimensional 
array library would profit from this), but if you really see that in 
your code it becomes and issue (looking at profiling) then normally it 
is quite easy to rewrite it so that it is fast.
Just looking at very specific benchmarks that test one kind of 
optimization can be very misleading.
It is good to have benchmarks and know where the weaknesses of a 
compiler are, but for real code the situation is different.
At least for the code that I write, and typical code I have seen DMD is 
reasonably competitive.
(this does not mean that it can't and shouldn't be improved ;)

Fawzi




More information about the Digitalmars-d mailing list