Now that's a cool article, Luke. Thanks for posting it!
A few months ago, I was talking about the advantages of the managed vs. unmanaged code with one of my former classmates who is now a successful professional programmer in Germany. Apart from many other languages, he is coding in C++ (both unamanged and .NET managed) as well as in C#.
I asked him whether there's a significant overhead in using C#.NET compared to the "rock-solid & ultimate pro" unmanaged C++
He said a crucial thing to me: it doesn't really matter what language do you code in or whether the code is managed or unmanaged in the first place, but it only matters how the actual resulting
machine code looks (which is very true!). And he said that .NET does the hell of a good job when generating the actual machine code.
It seems like .NET MSIL + JIT compilation tandem simply generates a code that is perfectly "curve-fitted" to the actual CPU where the code is being run. These JIT runtime optimizations can't be done remotely at the programmer's desk.
A negative aspect of .NET code might be the time needed to JIT compile the code in some cases. If one would code an application that only performs a quick task once and exists, it would probably take more time to run such a managed app than an unmanaged that doesn't have to deal with JIT.
Concerning the "wonder compilers" of .NET, then obviously, if one would write a humpty dumpty code which is inefficient by definition, even the best set of compilers would not make much out of it. But that's true for any programming language, regardless of it being managed or unmanaged.
In this respect, when I was reading the NeoTicker manual for the first time, it was quite puzzling to me that the NeoTicker guys wrote the following in the
IDL Interface / IDL Overview section:
NeoTicker manual wrote:If possible, you should compile the indicator into standard DLL or early binding ActiveX DLL. Late binding ActiveX DLL runs slower. .NET DLL run slowest.
I'm inclined to think that if the above is true, it's mainly because the NeoTicker COM Interop-based object model is ancient and needs replacing. Even the fastest Lamborghini doesn't perform well if it is dragging a 5-ton boat behind
Michal