Qba's picture

C# & OpenTK vs C++ & pure OpenGL

I was wondering if anyone ever measured the difference in fps while using C++ and pure OpenGL and using C# and OpenTK? Of course it surely will depend on the specific program but something like an average estimation?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

The MSDN forums have several C vs. C# discussions that give an idea about performance differences in ported projects (some say 10%, some say 7%, some say it's not measurable. Depends on the application.) ...but remember never to trust a statistic that wasn't faked by yourself ;)

Like Tim Sweeney (Unreal tech god) put it: "Will gladly sacrifice 10% of our performance for 10% higher productivity" http://cag.csail.mit.edu/crg/papers/sweeney06games.pdf

the Fiddler's picture

The most important part in .Net is the garbage collector. As long as you play well, performance should be close. It really depends on the program though - the more complex the program, the less pronounced the difference will be.

The one place where the difference can be significant are math functions, because you cannot microoptimize C# code with MMX, SSE etc.

Other than this, there is a set overhead on OpenGL/OpenAL function calls, typically between 8-25ns per call (the Mono runtime is significantly faster here). This is unlikely to make a difference in the real world, however, unless you are using immediate mode (which you shouldn't).

For most applications the difference in fps will not be important, especially in view of the savings on development time. If the profiler indicates that there is a bottleneck in C#/OpenGL, you can always spend some of the saved time rewriting specific parts in C. :-)

Qba's picture

Thanks.