XSight RT was written as a proof of concept: a demonstration of the capabilities of the .NET Framework and a working proof that, even CPU hungry applications, could be developed for this software platform. That's why we chose to write yet another ray tracer.
Please note that memory allocation in .NET is a lot faster than in any other native framework... because .NET's garbage collection strategy.
When a project must deal with mathematics and geometry, the designer is tempted to use and abuse of the functional features of the programming language: functions that return complex types, user defined operators, lambda expressions where available... All these sweet features have a cost in execution time, and it's easy to see why.
For instance, XSight RT defines vectors as a structure with three double precission fields. Our first implementation provided user defined operators for all common vector operations. There was an operator which received two vectors and returned their inner product... I mean, this routine received two vector parameters passed by copy: forty eight bytes had to be copied for each call. So, we transformed the inner product into a "regular" method of the Vector structure. It still needs the second parameter to be passed by copy, but the first parameter is now passed by address.
Home | An overview of ray tracing | How does a ray tracer work? | The limits of ray tracing | Small Instantiation Language Reference