Article - Is Managed Code Slower Than Unmanaged Code?

C# discussion

Moderator: moderators

Luke
rank: 50+ posts
rank: 50+ posts
Posts: 65
Joined: Sat Jul 01, 2006 1:46 pm
Reputation: 0
Gender: Male

Article - Is Managed Code Slower Than Unmanaged Code?

Postby Luke » Thu Aug 30, 2007 2:54 am

I found this to be an interesting read:
http://www.grimes.demon.co.uk/dotnet/man_unman.htm

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Re: Article - Is Managed Code Slower Than Unmanaged Code?

Postby michal.kreslik » Thu Aug 30, 2007 9:42 am

Luke wrote:I found this to be an interesting read:
http://www.grimes.demon.co.uk/dotnet/man_unman.htm


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

pr
rank: <50 posts
rank: <50 posts
Posts: 15
Joined: Thu Sep 07, 2006 1:49 pm
Reputation: 0
Gender: None specified

Postby pr » Fri Aug 31, 2007 12:52 pm

Michal,

I share your concern for the technological base of NeoTicker. My own observations of todays trading software "scene" indicate that at this point platforms with a .Net technology base are screaming ahead of all others in terms of rate of delivery of feature innovations and bug fixes.

Yes, at this moment, in some cases, legacy platforms remain the most powerful overall - but their lead is eroding so quickly it's stunning. IMO, any Windows-oriented legacy platform that is not already well underway towards a full conversion to .Net is destined to be toast, and much sooner than nearly anybody realizes.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “C# coding for NeoTicker”