Solved

Efficiency of VB vs C#

Posted on 2004-10-10
3
360 Views
Last Modified: 2008-02-26
I already know vb.net and I am taking the plunge to learn C#.  My question is this; Say I write two identical programs (performs the same tasks and looks the same) , one in VB.net and one in C#.  Is there a speed difference between the two programs?  I have heard C# is more efficient than VB.  Please clue me in on this. Thanks.
0
Comment
Question by:hunterdnance
3 Comments
 
LVL 18

Expert Comment

by:JR2003
ID: 12271656
I don't see that C# would be anymore efficient than VB.NET. For each VB.NET line there is an equivalent in C# and the .NET compiler should compile then to the same .NET framework common language code.
0
 
LVL 3

Accepted Solution

by:
KeithWatson earned 500 total points
ID: 12271778
The only significant difference between C# and Visual Basic with respect to performance is that C# allows you to declare "unsafe" sections of code (given the correct compiler options). Unsafe code allows you to manipulate memory directly using pointers, much as language like C and C++ do. Using pointers, there is the potential to improve performance in certain circumstances; the tradeoff being that it's more difficult to program and easier to introduce defects, which can often be tricky to track down.

However, your question assumes you write identical programs. They both compile into MSIL, so give or take any failures in the compilers, there's no reason why one would run faster than the other.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12271917
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question