Why DMD is so slow?

Fawzi Mohamed fmohamed at mac.com
Wed Jun 4 07:55:27 PDT 2008


On 2008-06-04 02:49:33 +0200, "Dave" <Dave_member at pathlink.com> said:

> 
> "Saaa" <empty at needmail.com> wrote in message 
> news:g240q6$14cm$1 at digitalmars.com...
>> I meant GDC :/
>> The original post reports a more than one minute runtime using DMD,
>> I can't replicate that (with a reasonable cpu).
>> Or did I miss something ..
> 
> I think you're on to something.
> 
> I get wildly different timings over several runs, and sometimes get a 
> (much) faster time _without_ the -O switch on a P4.
> 
> No way should that code be that much slower between DMD and GDC... It's 
> a bug. It's probably an alignment issue, but I wouldn't be surprised to 
> see incorrect results for DMD either.
> 
> The OP should post that code and the results as a bug. C++ code with 
> DMC probably wouldn't reproduce it because the D version is using the 
> built-in complex type, which is probably the heart of the bug.
> 
> http://d.puremagic.com/issues/enter_bug.cgi
> 
> - Dave

Yes I think this is probably a bug, and should be reported.
Maybe actually the unoptimized version is faster.
In any case one should *never* benchmark something that does not 
print/use something depending on what has been calculated:

1) no way to verify if the calculation was correct
2) some smart compiler might even optimize away the whole calculation 
(correctly because it is not needed)

In this case it is possible that some bug makes NaNs appear, and 
depending on the IEEE compliance settings of the processor NaNs might 
slow down the calculation very much (I saw a factor 100 in some 
calculations).

Fawzi



More information about the Digitalmars-d-learn mailing list