Eran Kampf
Eran Kampf
1 min read

Matrix4 benchmark results

The benchmark measured the time (in seconds) of 1,000,000 random matrix multiply operations on the different matrix implementations.
The test used the latest Sharp3D.Math build (compiled using VS2003), DirectX october update and VS2005 beta 1.

The results are:

  1. Sharp3D.Math.Core.Matrix4F – 0.2857308100 seconds
  2. Matrix4<float> C# Kernel – 0.3076677100 seconds
  3. Matrix4<float> DirectX Kernel – 0.9436617200 seconds
  4. DirectX – 0.1269457500 seconds.

As expected, the DirectX CPU optimized code runs the fastest.

I thought that using a DirectX kernel will make Matrix4<float> faster than using a C# implementation but it seems that the Matrix4<float> <–> Microsoft.DirectX.Matrix conversions are killing the performance benefits…

I expected the generic Matrix4 C# implementation to run just as fast as its non-generic counterpart but unfortunately it is slower. This is probably caused by using an interface for the kernel operations…

If anyone has an idea about how to make the conversion too\from DirectX faster and\or how to make the C# implementation just as fast as its non generic counter part I’d appreciate a comment or mail…