Why is this D code slower than C++?

Steve Horne stephenwantshornenospam100 at aol.com
Wed Jan 17 14:38:41 PST 2007


On Wed, 17 Jan 2007 22:34:31 +0000, Steve Horne
<stephenwantshornenospam100 at aol.com> wrote:

>On Wed, 17 Jan 2007 11:18:10 -0800, Bradley Smith
><digitalmars-com at baysmith.com> wrote:
>
>>Thanks for all the suggestions. It helps, but not enough to make the D 
>>code faster than the C++. It is now 2.6 times slower. The render times 
>>are now approx. 13 sec for raytracer_d and approx. 5 sec for raytracer_cpp.
>
>...
>
>>
>>Any other suggestions?
>
>I haven't actually looked at the code, but I'll take a guess anyway.
>
>Raytracing is heavy on the floating point math. As Walter Bright
>acknowledges, the DMD compiler does not handle the optimisation of
>float arithmetic as well as some C++ compilers.

On second thoughts, if you're comparing with the DMC compiler for C++,
floating point math performance seems a less likely issue. It seems
odd that there's such a difference between the DMD and DMC compilers.
You'd think the DMD compiler would use much the same back-end code
generation that DMC does.

-- 
Remove 'wants' and 'nospam' from e-mail.


More information about the Digitalmars-d-learn mailing list