Why is this D code slower than C++?

Bradley Smith digitalmars-com at baysmith.com
Thu Jan 18 13:35:13 PST 2007


Bradley Smith wrote:
> As Bill Baxter pointed out, I missed an optimization on version 2. The 
> pass by reference optimization using the inout on the Intersect's Ray 
> argument. I had applied inout only to the Raytrace's Ray argument.
> 
> The further optimization brings the following approx. timings:
> 
>         time     factor
>   dmc    5 sec    1.0
>   dmd    9 sec    1.8
>   gdc    13 sec   2.6
     gdc    10 sec   2.0      <-- correction
>   msvc   5 sec    1.0
>   g++    doesn't compile
> 

Here is a correction to the gdc results. The wrong optimization flag was 
used. The build_d_gdc.bat should have "-O3" rather than "-O".


More information about the Digitalmars-d-learn mailing list