|
-
Sep 20th, 2009, 12:42 PM
#1
Thread Starter
Hyperactive Member
Which Is Faster?
In a built .Net application, which executes faster? VB or C#?
Historically, C++ or any variant thereof, would run circles around a VB application. It would seem to me that this might still hold true. Both depend on Framework, so I don't know...
The reason I ask is that I have a heavy number-crunching application I wrote in VB2008. If it would help, I would recode it in C#. However, I am just starting to learn C#, so it would be sort of hard to do. The other side of that coin is what I would learn in the process.
-
Sep 20th, 2009, 01:22 PM
#2
Re: Which Is Faster?
While there are probably some things that might be faster or only possible in C# (unmanaged C#?), for the most part you probably would not see a difference.
You have to consider that C# has little to do with C/C++, and is actually more of a private (legally defensible this time - remember the VJ++ debacle a.k.a. Sun Lawsuit?) clone of Java. VB.Net is just a syntactic alternative using a different compiler plus a few VB.Net-specific libraries.
C# is arguably much more closely related to Java than anything else. The funky syntax is because all of these "inherit" from the C/C++ world-view of programming language syntax.
-
Sep 20th, 2009, 01:36 PM
#3
Re: Which Is Faster?
You could also look at Which is faster? VB 6 or VB.NET?
I'm sure he was using an earlier version of VB.Net here, and 2008 ought to do better, perhaps much better.
-
Sep 20th, 2009, 05:44 PM
#4
Thread Starter
Hyperactive Member
Re: Which Is Faster?
 Originally Posted by dilettante
You could also look at Which is faster? VB 6 or VB.NET?
I'm sure he was using an earlier version of VB.Net here, and 2008 ought to do better, perhaps much better.
I'm using VB.Net 2008 EE.
In another group, I spoke of using Visual C++. Coming from a VB background, a few thought C# would be a better choice.
-
Sep 20th, 2009, 06:48 PM
#5
Re: Which Is Faster?
 Originally Posted by storm5510
I'm using VB.Net 2008 EE.
In another group, I spoke of using Visual C++. Coming from a VB background, a few thought C# would be a better choice.
Better is a subjective term. The article doesnt have a published date so who knows how old it is. If its new and 2008 was used then VB6 FTW! Otherwise I would think the difference will get smaller and smaller as newer versions of the FW and VS come out.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2009, 08:03 PM
#6
Re: Which Is Faster?
 Originally Posted by storm5510
In a built .Net application, which executes faster? VB or C#?
It doesn't matter, both run on the same framework in the same virtual environment. When you compile a c# project and an identical vb.net project, they both produce virtually identical MSIL code that gets ran in the CLR.
It doesn't mean anything, but the framework itself is in C# btw.
-
Sep 20th, 2009, 08:08 PM
#7
Re: Which Is Faster?
The FW being in any anguage makes no difference. VS is partially written in VB.NET too. Its all the very same or slightly different MSIL code so no matter how you get there, it gets there looking the same.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2009, 09:13 PM
#8
Re: Which Is Faster?
Another issue might be the kind of "crunching" involved. If it is the sort requiring large integers (64 bit) and high-precision foating point a 64-bit OS and code compiled for it might help. If the precision isn't a factor then 32-bit code can be faster (even under WOW64) if huge arrays of them are needed, just because of the reduce memory usage and paging disk I/O.
The article doesnt have a published date so who knows how old it is.
I personally find that incredibly annoying about this sort of article as well as many blogs. Often you have to scroll all over looking for fine, pale print to find a date, if there is one there at all.
This seems incredibly inappropriate to me and completely uncalled for. Articles and blogs ought to have prominent publication and revision dates under the main headings always. The lack of an uproar resulting in a change makes me question the honesty of many authors and information sources (magazine sites). Perhaps copyright should be contingent on this if it isn't already.
-
Sep 20th, 2009, 09:20 PM
#9
Thread Starter
Hyperactive Member
Re: Which Is Faster?
This all sounds like the individuality has been removed from each language. If this is the case, then why try to learn something new? There is no advantage for any over another.
-
Sep 20th, 2009, 09:50 PM
#10
Re: Which Is Faster?
Each language has its strengths and weaknesses. They both share the same FW. So you usse the best language for each project. Most shops dont like to support both so they have their developers write in all one language.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2009, 10:06 PM
#11
Thread Starter
Hyperactive Member
Re: Which Is Faster?
 Originally Posted by RobDog888
...Most shops dont like to support both so they have their developers write in all one language.
Sounds reasonable. I looked at some job adds today. All were wanting IT people with C# experience, among other things.
-
Sep 20th, 2009, 10:21 PM
#12
Re: Which Is Faster?
For a time it seemed that Microsoft wanted VB.Net to become the hobby and casual user language, C# the one for Mort. Things didn't work that way, so later as they got into the Silverlight frame of mind Microsoft seemed to be directing VB.Net into the dynamic language realm with VBx (VB.Net 10). That didn't pan out well either, and the last I heard they merged the C# and VB.Net dev teams within Microsoft.
I don't see VB.Net going anywhere (or is that "going away?") soon. It should be around until .Net fades away.
-
Sep 21st, 2009, 12:15 AM
#13
-
Sep 21st, 2009, 02:14 AM
#14
Thread Starter
Hyperactive Member
Re: Which Is Faster?
 Originally Posted by dilettante
...Microsoft seemed to be directing VB.Net into the dynamic language realm with VBx (VB.Net 10)...
I don't see VB.Net going anywhere (or is that "going away?") soon. It should be around until .Net fades away.
I read somewhere a few months ago, that VS 2010 would no longer be Framework dependent. That was my main reason for not abandoning VB6. It's run-time requirements are just about nil compared to .Net. I was later told here that Framework wasn't going anywhere. I felt sort of deflated. Successfully installing .Net applications on other machines is a royal pain, for me, anyway.
-
Sep 21st, 2009, 07:28 AM
#15
Re: Which Is Faster?
 Originally Posted by storm5510
I read somewhere a few months ago, that VS 2010 would no longer be Framework dependent. That was my main reason for not abandoning VB6. It's run-time requirements are just about nil compared to .Net. I was later told here that Framework wasn't going anywhere.
Where did you hear all this? I mean realistically speaking, if MS is pushing for the framework to go away, how come it's being implemented in most of their latest projects? I mean key components of Vista where built in .Net and even moreso in Win7, heck they're still talking about dropping vba from Office and putting it on .Net as well. (could you imagine it, having an Office app written in either c# or vb.net instead of just vba?)
I double the Framework's going be dropped anytime in my son's lifespan (he's only 5 right now).
Considering VS 2010 is written in WPF (which is .Net only), I'd have to say chances of VS being FW independent is a very wild statement since they keep making it more and more dependent since VS 2002.
-
Sep 21st, 2009, 09:22 AM
#16
Re: Which Is Faster?
I think the comment of VS2010 being FW independant was taken out of context. The independence comes in that you will be able to target ANY FW version... to include 1.0 (I think) ... that means you if you still have an app targeting FW1.1, you'll be able to upgrade it to VS2010 and maintain it there... it allows those shops that have multiple apps at varying FW versions to use a single, common IDE, with out the need to install multiple IDEs for new developers, helping to cut costs.
The FW isn't going any where... at least for now.
-tg
-
Sep 21st, 2009, 09:48 AM
#17
Thread Starter
Hyperactive Member
Re: Which Is Faster?
 Originally Posted by techgnome
I think the comment of VS2010 being FW independant was taken out of context...
I believe you are correct. I remember where I saw it. MSDN web site.
-
Sep 21st, 2009, 04:06 PM
#18
Re: Which Is Faster?
Microsoft is pushing the .NET framework harder than ever. They're slowly muscling in on the market share ruled by languages like Java and C++ and gaining ground.
As for VB6 (i.e. Original Visual Basic), I consider it dead, at least from the standpoint of "Microsoft don't support it anymore and we aren't going to ever see any improvements or advancements to the language anymore"; but as long as Windows operating systems can still run the VB6 dlls; either naively or in some compatibility mode designed to allow older programs to function, it won't disappear completely.
-
Sep 21st, 2009, 09:57 PM
#19
Thread Starter
Hyperactive Member
Re: Which Is Faster?
 Originally Posted by Jenner
...As for VB6 (i.e. Original Visual Basic), I consider it dead...
It's amazing to see how many still use VB6 as opposed to .Net. The number of threads here sort of gives a hint. 93 thousand for .Net and 231 thousand for VB6. There must be a lot of people displeased with .Net. This says something about .Net. What that may be, I don't know. Each person is different.
-
Sep 21st, 2009, 11:40 PM
#20
Re: Which Is Faster?
I cringe when ever I see that statistic because it lies, it's misleading, not to mention totally bogus. Considering that VB6 has been around for A LOT LONGER, that doesn't surprise me.
If you want to read it that it means there are that many people displeased with .NET, fine, then I say it goes to show just how much of a pain it is to use VB6 that that many people need help with it.
The future of VB6 as a development language is basically dead. As a maintenance language, yes, it's still in use full force. There will come a day when VB6 apps go the way of the dodo.
-tg
-
Sep 22nd, 2009, 03:41 AM
#21
Thread Starter
Hyperactive Member
Re: Which Is Faster?
 Originally Posted by techgnome
If you want to read it that it means there are that many people displeased with .NET, fine, then I say it goes to show just how much of a pain it is to use VB6 that that many people need help with it.
That is an alternate explanation and one I never thought about. VB6 has been around many years and that makes me wonder if users posting here have no documentation because they obtained the software by alternate means? Perhaps it was given to them. They may have downloaded a CD image from an out-of-country pirate source. I see that as being very likely. A while back, I did a search on eBay just to see if I could find it. Not one hit. Those who have it are not parting with it. I won't. I also have the full manual set; four thick paperback books from MS Press.
Last edited by storm5510; Sep 22nd, 2009 at 03:45 AM.
-
Sep 22nd, 2009, 03:42 AM
#22
Re: Which Is Faster?
This topic causes heavy debate.
However in essence, (And someone please correct me if I'm wrong) C# and VB (.net) run the same framework and the speed difference is not worth thinking about. However C# can run faster as it supports unmanaged code. But again do you really need that when producing websites? Chances are no, and if you did have a heavy app that you needed to run really fast would you use c#? again the answer would be no.
What I'm saying here is right tool for the job and a good programmer has a bag of tricks so to speak so can approach any development job.
An other thing to look at is what the job market in your area is like, here we have no decent VB jobs there all C# thats just the way it rolls here. However others have said that they have more Vb than c#... so just have a look around
Pino
-
Sep 22nd, 2009, 04:33 AM
#23
Re: Which Is Faster?
 Originally Posted by storm5510
... There must be a lot of people displeased with .Net. This says something about .Net. What that may be, I don't know. Each person is different.
I don't think so many people are displeased by .Net as maybe just not pleased by it. To me the distinction is one of hostility vs. indifference.
What seems more of a puzzle to me is how many rank newbies seems to be asking simple VB6 questions. On the one hand you have to wonder where they even got it (and yes there are still sources for legit, even new legit copies of the VB6 toolset - they're just hard to locate). More astounding to me though is the trivial nature of so many questions ("How do I save a TextBox to a disk file?").
I'm sure some of this is the preliterate hominid YouTube Generation we're cultivating (old fart waves cane in the air to make his point). A lot of it may be a liguistic barrier. But still more is probably the use of "hot" copies of the VB6 software without the accompanying docs.
Frankly I'll be happy when Microsoft tires of their Java clone and gets back to business. VB needs a facelift, and Microsoft doesn't offer a serious alternative to C++ for native development right now. I'm indifferent to .Net myself except for the resources it takes away from other efforts, but then I'm not working as a Mort.
-
Sep 22nd, 2009, 05:47 AM
#24
Re: Which Is Faster?
I think I need a cane to wave too!
 Originally Posted by storm5510
It's amazing to see how many still use VB6 as opposed to .Net. The number of threads here sort of gives a hint. 93 thousand for .Net and 231 thousand for VB6.
This site has been around much longer that VB.Net has - so by the time it was released the VB6 forum (which was used by the .Net coders too before 2002) had many tens of thousands of threads. Even if you knew how many threads the VB6 forum had at that time, comparisons would be unreliable at best (as many people have been 'locked in' to VB6 by their employers to varying degrees, to support existing software).
Note that for a long time now the VB.Net forum has had more active threads (per day/week/month) than the VB6 forum has - today is a 'good' day for the VB6 forum, as it has about 50 posts since my last visit yesterday, compared to about 70 for the VB.Net forum (it is usually nearer 40 vs 70). The move of people from one to the other is slow, but very definite.
-
Sep 22nd, 2009, 06:03 AM
#25
Re: Which Is Faster?
Even ignoring the other issues a higher rate of .Net questions makes sense. It is gaining newcomers (both sprightly and decrepit) while VB6 is pretty... mature. You'd tend to think most people using VB6 are pretty comfortable with the basics by now, with most questions being relatively exotic or dealing with new Windows version issues at this late date.
Since even this "feeling" seems to be incorrect I'd hesitate to draw any kind of conclusions from numbers of posts. However counting from Day 1 doesn't make much sense in any case.
-
Sep 22nd, 2009, 07:48 AM
#26
Re: Which Is Faster?
Add to the fact that VB.NET is a free download from Microsoft these days and the fact that these forums doesn't throw anything away, it's easy to see the skewed statistics.
Does Microsoft need a competitor for C++? Maybe. At this point, I don't see why. I see framework programming as the next level of technological advancement in the standard computing model. It's like a fully stocked mechanics garage filled with tools. Sure there's a lot of them and they take up space, but you don't have to make your own tools all the time. Focus less on banal memory allocation, bit-shifting through strings, passing around pointers, and other highly time consuming hells that a C++ systems programmer has to deal with daily.
Focus on getting the job done. The thing that kills most programming projects isn't so much lack of talent, as is lack of time and motivation. The less time a programmer needs to spend on the nitty-gritty and the more on getting results, the better the product in the long run.
Then again, there are still some people loopy enough to insist we all program in assembler. Sorry mates, stopped doing that with my Commodore 64.
-
Sep 22nd, 2009, 10:22 AM
#27
Re: Which Is Faster?
To get back to the original question: If you are doing extensive number crunching, then neither of the .NET languages will be as fast as C/C++. I tested a bunch of simple hacks, and find that for .NET, addition is the same speed as division (roughly, not exactly), even for integers. However, in ASM, integer addition should be VASTLY faster than integer division (unless the processor timing has changed more than I am aware). Back in the days of the pentium, integer addition and subtraction, along with bit twiddling, were part of the RISC subset of instructions, and ran at sub-cycle speed (you could do more than one operation per clock tick under ideal conditions). Multiplication was more than twenty times as slow, and division about sixty times as slow (only for integers, floating point was totally different). Timing per instruction is now so context dependent that they aren't directly comparable, but the rough comparison should hold true. Since it doesn't for .NET, where addition is roughly as fast as division, then it is likely that you can achieve performance advantages by using unmanaged C/C++ for certain math operations.
My usual boring signature: Nothing
 
-
Sep 22nd, 2009, 11:21 AM
#28
Thread Starter
Hyperactive Member
Re: Which Is Faster?
 Originally Posted by Jenner
Then again, there are still some people loopy enough to insist we all program in assembler. Sorry mates, stopped doing that with my Commodore 64.
Been there and done that, and not by choice. I had to take a class in college.
I made the change to VB2008 about six weeks ago. I have some issues with it, but nothing major. There are a few things missing in the language; probably more than I realize. So far, I've managed to get by.
The IDE is still a bit strange to me, but I've managed to find where the things are that I need. The "news channel" could go away. It is just another tab to close.
-
Sep 22nd, 2009, 11:34 AM
#29
Re: Which Is Faster?
The "news channel" can be disabled as an option. I dislike it intensly, myself.
One thing you might look into eventually is the option to Turn Off Integer Overflow checks. These checks really whallop the performance of math, so if you are math intensive, and you know that you will be working with numbers that won't be larger than an integer can hold, then turn that off. You will find that on Project|Properties, then I think it is buried on the Compile options tab.
My usual boring signature: Nothing
 
-
Sep 22nd, 2009, 12:43 PM
#30
Thread Starter
Hyperactive Member
Re: Which Is Faster?
I am using ULong data types. I don't know if that would apply or not.
I cannot find any setting relative to the News Channel. Where might that be?
-
Sep 22nd, 2009, 01:35 PM
#31
Re: Which Is Faster?
 Originally Posted by storm5510
Been there and done that, and not by choice. I had to take a class in college.
I made the change to VB2008 about six weeks ago. I have some issues with it, but nothing major. There are a few things missing in the language; probably more than I realize. So far, I've managed to get by.
The IDE is still a bit strange to me, but I've managed to find where the things are that I need. The "news channel" could go away. It is just another tab to close.
The "news channel" is on the Start tab, which also lists the most recent projects opened which is very convenient, but you have have VS not open with the Start tab on startup too.
-
Sep 22nd, 2009, 03:32 PM
#32
Re: Which Is Faster?
BTW, what things do you think it's missing? One of the things about .NET that a lot of programmers who are used to VB6 (myself included when I switched about 5 years ago) complain about are missing features like Control Arrays and such.
Most of these things are missing because there are far better ways to handle such things now; they're obsoleted. About the only thing VB.NET lacks that VB6 had was a native code compiler; but that doesn't make much sense with a framework style language anyways.
-
Sep 22nd, 2009, 04:27 PM
#33
Re: Which Is Faster?
 Originally Posted by storm5510
I am using ULong data types. I don't know if that would apply or not.
I cannot find any setting relative to the News Channel. Where might that be?
Absolutely. ULong are unsigned long integers. The integer overflow checks will imapact you. If the majority of time in your program is spent on math with these integers, the impact will be severe. However, most programs don't spend the majority of their time on math. A few do, though.
My usual boring signature: Nothing
 
-
Sep 22nd, 2009, 05:11 PM
#34
Thread Starter
Hyperactive Member
Re: Which Is Faster?
I turned the checks off. No difference in speed.
I found the setting for turning off the news channel also.
-
Sep 22nd, 2009, 06:22 PM
#35
Re: Which Is Faster?
If there was no difference in speed then integer math wasn't a major factor in the speed. That's actually true for the VAST majority of programs.
My usual boring signature: Nothing
 
-
Sep 22nd, 2009, 07:52 PM
#36
Re: Which Is Faster?
 Originally Posted by Jenner
... but that doesn't make much sense with a framework style language anyways.
VB6 has a "framework" too, it just wasn't ever called by such a gauche name. You have the intrinsic controls and objects in the runtime, the "extended runtime" controls and objects, and then the OS components like ADO, the Scripting Runtime, CDO, and so on.
-
Sep 22nd, 2009, 08:10 PM
#37
Thread Starter
Hyperactive Member
Re: Which Is Faster?
The days of the truly "stand-alone" executable program are long gone. I can understand dependencies. Sometimes, the list seems to become too much. I gave up on one VB2008 application that would not load under Vista; same result with XP on my old desktop until I actually installed VB2008 on it. I never had to open it. The app would run after that.
Sorry, this is off-topic.
-
Sep 23rd, 2009, 07:51 AM
#38
Re: Which Is Faster?
 Originally Posted by dilettante
VB6 has a "framework" too, it just wasn't ever called by such a gauche name. You have the intrinsic controls and objects in the runtime, the "extended runtime" controls and objects, and then the OS components like ADO, the Scripting Runtime, CDO, and so on.
That's so loosely coupled that I'd hardly call any of it a "framework".
 Originally Posted by storm5510
The days of the truly "stand-alone" executable program are long gone. I can understand dependencies. Sometimes, the list seems to become too much. I gave up on one VB2008 application that would not load under Vista; same result with XP on my old desktop until I actually installed VB2008 on it. I never had to open it. The app would run after that.
Sorry, this is off-topic.
I'm still curious to what you're code is doing that would cause it to not work, I mean even when you run the program from the IDE it's still only running on the Framework, which is the same one the IDE itself runs on. I've never had any kind of trouble like that. I almost wouldn't mind seeing the project (the source code) sometime.
-
Sep 23rd, 2009, 09:48 AM
#39
Re: Which Is Faster?
If it was anything like my first experience with a program in Vista, I double-clicked the icon, and nothing would happen, nothing at all! No error, no crash, no security warning, nothing.
Found out it was because my program was trying to write to the registry and Vista was just outright killing it for security issues without so much as a peep. I pulled my hair out for days before I figured that out.
-
Sep 23rd, 2009, 10:02 AM
#40
Re: Which Is Faster?
I dont know if thats a general Vista security feature or if its due to the lovely 'problem' with .NET apps running on Vista where anything in the form load event wont actually throw an exception... even if it does on XP. Does my head in that one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|