I created simple ray tracer in Java as a hobby project, and well, it’s slow. Not dramatically slow, but slow nevertheless. I wonder if I can get any performance gain using lower level language like C or C++ or will the difference be negligible and I should stick to improving “my” algorithm?
Share
I think the question have been answered as YES a not interpreted language will in 99.99% of the cases run faster than the same algorithm under a VM.
This said (having worked a lot in image processing both in java and c/c++ where memory and time mattered) I think you should at first try to optimize your code, here are are my advises:
Then (just few examples I could see for raytracing):
Now those things are “good” but if the speed is really critical for you, I would not suggest to use a c or c++ language (even if you could) but more likely to focus on OpenCL. This is probably the best tool available and most adapted for building ray tracings engine. Just imagine you are not talking there of an improvement of 30% but more likely 10’000% (100x faster) Here is a java interface: http://jogamp.org/jocl/www/
Good luck 🙂