Raytracing speed again, this time with gdc.

Jascha Wetzel firstname at mainia.de
Thu Nov 8 04:54:10 PST 2007


downs wrote:
> I've tried to translate the attached C++ program to D (D program also
> attached).
> 
> Even after explicitly using the __builtin_sqrt (which correctly
> generates a fsqrt instruction (shame on you, non-inlined std.math)), the
> D code is significantly slower (12.9s for D vs 9s for C++).
> 
> Does anybody know why this is so?
>  --downs, confused and saddened
> 
> PS: benchmark
> 
> gentoo-pc ~/d/RayBen $ gdc ray1.d -O3 -frelease -ffast-math -o ray1_d
> tools/base.d && time ./ray1_d >result_d.pnm; g++ ray1.cxx -O3
> -ffast-math -o ray1_cpp && time ./ray1_cpp > result_cxx.pnm
> 
> real    0m13.448s
> user    0m12.730s
> sys     0m0.090s
> 
> real    0m10.128s
> user    0m9.810s
> sys     0m0.020s
> 

did you try to profile both versions?
also try benchmarking without the IO.


More information about the Digitalmars-d-learn mailing list