Solved

Efficiency of VB vs C#

Posted on 2004-10-10
3
333 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now