Optimizing a raytracer
"Róbert László Páli"
robertlaszlopali at gmail.com
Wed Oct 16 05:02:14 PDT 2013
Hello!
I am writing an unbiased raytrace renderer in D. I have good
progress, but I want to make it as fast as possible where I can
do it without compromises.
I use a struct with three doubles for vector and color
calculations and I have operator overloading for them. Many
vectors and colors are created during the tracing calculations.
I thought, using classes may require too much memory, because
they are not destructed on scope end, and maybe speed reduction
when GC kicks in.
Is my assumptions that in this case struct are more wise?
To avoid the constructing many vectors and colors, I thought to
use ref arguments, but I also heard that ref functions are not
inlined. What would generate the fastest code for a cross-product
for example?
What compiler and compilations flags should I use to generate the
fastest code? My main target is sixty-four bit machines,
cross-platform. What optimizations can I assume for various
compilers? Are only once used local variables inlined? So it
secure to extract local variables only to make the code more easy
to understand?
Thanks is Advance!
Róbert László Páli
More information about the Digitalmars-d
mailing list