D slower than C++ by a factor of _two_ for simple raytracer (gdc)

Unknown W. Brackets unknown at simplemachines.org
Thu Feb 14 22:40:58 PST 2008


Well, I'm on Windows, but comparing DMC and DMD on that code, DMD is 
slightly faster.  I know that gdc isn't really optimizing everything yet....

That said, cl (v15) beats dmc and dmd at like 60% the time, but this has 
less to do with the language itself.

I wonder how gcc and dmd compare here...

-[Unknown]


downs wrote:
> My platform is GDC 4.1.2 vs G++ 4.1.1.
> 
> I played around with the simple ray tracer code I'd ported to D a while back, still being dissatisfied with the timings of 21s (D) vs 16s (C++).
> 
> During this, I found a nice optimization that brought my D code down to 17s, within less than a second of C++!
> 
> "Glee" I thought!
> 
> Then I applied the same optimization to the C++ source and it dropped to 8s.
> 
> I haven't been able to get the D code even close to this new speed level.
> 
> The outputs of both programs are identical save for off-by-one differences.
> 
> The source code for the C++ version is http://paste.dprogramming.com/dpvpm7jv
> 
> D version is http://paste.dprogramming.com/dpzal0jd
> 
> Before you ask, yes I've tried turning the structs into classes, the classes into structs and the refs into pointers. That usually made no difference, or worsened it.
> 
> Both programs were built with -O3 -ffast-math, the D version additionally with -frelease.
> Both compilers were built with roughly similar configure flags. The GDC used is the latest available in SVN, and based on DMD 1.022.
> 
> Does anybody know how to bring the D results in line with, or at least closer to, the C++ version?
> 
> Ideas appreciated,
> 
>  --downs



More information about the Digitalmars-d mailing list