C# .NET vs VB .NET

  • Thread starter Thread starter alan
  • Start date Start date
alan, I'd search google, there are tons of articles and long debates in NG's
about which language is better/worse along with basic facts about the real
differences. The short answer to your question is that there are more
differences than syntax but for most developers these differences are
outside the scope of what they will use.

Here's a place to get you started:
http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=difference+C#+vb.net
 
Hi Alan,

Actually, programmers will focus on the performance difference. If your
concern is performance difference, this article may help you:
http://builder.com.com/5100-6373-1027686.html

Normally, the C# and VB.net difference white paper is available:
http://support.microsoft.com/?kbid=308470

Hope this help you. Have a nice day!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I dont see how there can be a performance difference (with VB Option Strict
on) because they both compile to IL... and I've noticed that they typically
compile to the same IL...

"Jeffrey Tan[MSFT]" said:
Hi Alan,

Actually, programmers will focus on the performance difference. If your
concern is performance difference, this article may help you:
http://builder.com.com/5100-6373-1027686.html

Normally, the C# and VB.net difference white paper is available:
http://support.microsoft.com/?kbid=308470

Hope this help you. Have a nice day!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I dont see how there can be a performance difference (with VB Option
Strict on) because they both compile to IL... and I've noticed that
they typically compile to the same IL...

The point of the article was that they don't compile to the same IL, but
it was very anecdotal and was written about the beta. Mostly he found
some extra nops in VB.NET, which are unlikely to have any real
performance issues, and he didn't seem to realize that C# and VB have
different rules for loops which require slightly different IL.
 
David said:
The point of the article was that they don't compile to the same IL, but
it was very anecdotal and was written about the beta. Mostly he found
some extra nops in VB.NET, which are unlikely to have any real
performance issues, and he didn't seem to realize that C# and VB have
different rules for loops which require slightly different IL.

Those differences *can* make real performance differences though. For
instance, the JIT makes a decision about which methods to inline based
partly on how large the method is in bytes of IL. nop instructions will
therefore make a method less likely to be inlined. This *could* make a
vast difference - it's just that you'd have to have a method of the
right size (so that the C# version is just under the boundary and the
VB.NET version is just over the boundary) in order to get the effect.
 
Jon,
I don't have the link handy, as far as I know the NOPs are only inserted in
Debug builds to allow VB.NET to put break points on lines that you would
normally not be able to put break points on.

I'm looking at the IL for a release build & I see no NOPs, while the Debug
build has numerous NOPs.

Otherwise I agree the NOPs would impact the JIT.

Hope this helps
Jay
 
Jay B. Harlow said:
I don't have the link handy, as far as I know the NOPs are only inserted in
Debug builds to allow VB.NET to put break points on lines that you would
normally not be able to put break points on.

I'm looking at the IL for a release build & I see no NOPs, while the Debug
build has numerous NOPs.

Otherwise I agree the NOPs would impact the JIT.

It's not just NOPs though. Recently on either the CLR or C# mailing
list (I can't remember offhand) someone pointed out a case where VB.NET
used only two instructions for something where C# used three. They
tried to say that this meant that C# would be slower than VB.NET - but
of course the number of IL instructions is irrelevant for the most
part. It's only the JITted instructions which count - and those ended
up being the same... except the two instructions VB.NET emitted took
more IL space in *bytes* than the three that C# emitted, giving the
same inlining boundary possibilities as talked about here.
 
Jon,
It's not just NOPs though. Recently on either the CLR or C# mailing
list (I can't remember offhand) someone pointed out a case where VB.NET
I won't disput that! ;-)

As looking at the VB.NET IL, they do some strange things.

Jay
 
Back
Top