Raytracing speed again, this time with gdc.

downs default_357-line at yahoo.de
Thu Nov 8 05:09:10 PST 2007


Jascha Wetzel wrote:
>> 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.

Thanks for the input, but that's not it.

The IO of 262K cannot possibly account for three seconds of difference. Just for the books, same result without the printf call.

Here's the first three lines of each's profile run.
D version:
 time   seconds   seconds    calls   s/call   s/call  name
 77.27      5.10     5.10  6164146     0.00     0.00  void ray1.Group.intersect(inout typedef ray1.Hit, inout struct ray1.Ray, void*)
 15.15      6.10     1.00 38551270     0.00     0.00  void ray1.Sphere.intersect(inout typedef ray1.Hit, inout struct ray1.Ray, void*)
  4.55      6.40     0.30        1     0.30     6.56  _Dmain
All: 5.25s

C++ version:
 time   seconds   seconds    calls  ms/call  ms/call  name
 75.18      4.12     4.12  6164146     0.00     0.00  Group::intersect(std::pair<double, Vec>&, Ray const&) const
 19.34      5.18     1.06 38551282     0.00     0.00  Sphere::intersect(std::pair<double, Vec>&, Ray const&) const
  4.74      5.44     0.26                             main
All: 6.57s


 --downs


More information about the Digitalmars-d-learn mailing list