In one of my C# books, this is written:

"if you write this application in VB.NET or any other language compliant with the .NET CLS, you will have compiled it into more or less the same MSIL. By design, IL code created from different languages is virtually indistinguishable"

I was then asked this question: Why is there a difference between C# and VB in speed? I don't understand the above statement very well, but it seems to be saying that we end up with almost the same executable code.

I couldn't answer the question, so I thought I would ask you guys. Thanks!

8 Years
Discussion Span
Last Post by jbennet

more or less the same MSIL perhaps just means C# and VB can be processed by the same JIT-compiler, but because of differences in the MSIL code there may be differences in executing time.


In pre .net Id have agreed, in .net itself its not something Id given much thought.


All .NET code compiles identically. It is first compiled to CIL (formerley MSIL) which is then interpreted by the .NET CLR and is compiled to machine code.



There should be NO difference between the .NEt languages in speed (possibly with the exception of Managed C++ as MS seem to have far more compiler optimisation options for that - but i think thats mainly due to ms being wierd as opposed to a technological limitation)

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.