View Single Post
Old June 5th, 2009   #70 (permalink)
Exophase
Emu author
 
Join Date: Apr 2001
Location: Cleveland OH, USA
Posts: 1,184
I don't know what would be faster on C# because I don't know how switches or the indirect function calls you mention are implemented. I just know that theoretically a switch can be faster than an indirect function call because there's less return overhead, more stack frame/register consistency (frame and calling convention overhead) and better potential for optimization. If the function table performs better then the compiler is not doing a good enough job.

I wrote a big post on this once but all I could find was one that was basically like this one :/
Exophase is offline   Reply With Quote