PDA

Click to See Complete Forum and Search --> : Which Is Faster?


storm5510
Sep 20th, 2009, 12:42 PM
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.

:)

dilettante
Sep 20th, 2009, 01:22 PM
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.

dilettante
Sep 20th, 2009, 01:36 PM
You could also look at Which is faster? VB 6 or VB.NET? (http://visualbasic.about.com/od/imhoinmyhumbleopinion/ss/VB6VSVBNET.htm)

I'm sure he was using an earlier version of VB.Net here, and 2008 ought to do better, perhaps much better.

storm5510
Sep 20th, 2009, 05:44 PM
You could also look at Which is faster? VB 6 or VB.NET? (http://visualbasic.about.com/od/imhoinmyhumbleopinion/ss/VB6VSVBNET.htm)

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.

RobDog888
Sep 20th, 2009, 06:48 PM
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! :D Otherwise I would think the difference will get smaller and smaller as newer versions of the FW and VS come out.

JuggaloBrotha
Sep 20th, 2009, 08:03 PM
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.

RobDog888
Sep 20th, 2009, 08:08 PM
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.

dilettante
Sep 20th, 2009, 09:13 PM
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.

storm5510
Sep 20th, 2009, 09:20 PM
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.

:sick:

RobDog888
Sep 20th, 2009, 09:50 PM
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.

storm5510
Sep 20th, 2009, 10:06 PM
...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.

dilettante
Sep 20th, 2009, 10:21 PM
For a time it seemed that Microsoft wanted VB.Net to become the hobby and casual user language, C# the one for Mort (http://www.codinghorror.com/blog/archives/001004.html). 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.

dilettante
Sep 21st, 2009, 12:15 AM
Visual Studio: Why is there no 64 bit version? (yet) (http://blogs.msdn.com/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx) was an interesting read.

storm5510
Sep 21st, 2009, 02:14 AM
...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.

JuggaloBrotha
Sep 21st, 2009, 07:28 AM
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.

techgnome
Sep 21st, 2009, 09:22 AM
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

storm5510
Sep 21st, 2009, 09:48 AM
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.

Jenner
Sep 21st, 2009, 04:06 PM
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.

storm5510
Sep 21st, 2009, 09:57 PM
...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.

techgnome
Sep 21st, 2009, 11:40 PM
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

storm5510
Sep 22nd, 2009, 03:41 AM
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.

Pino
Sep 22nd, 2009, 03:42 AM
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

dilettante
Sep 22nd, 2009, 04:33 AM
... 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 (http://www.codinghorror.com/blog/archives/001004.html).

si_the_geek
Sep 22nd, 2009, 05:47 AM
I think I need a cane to wave too!
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.

dilettante
Sep 22nd, 2009, 06:03 AM
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.

Jenner
Sep 22nd, 2009, 07:48 AM
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. :D

Shaggy Hiker
Sep 22nd, 2009, 10:22 AM
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.

storm5510
Sep 22nd, 2009, 11:21 AM
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.

Shaggy Hiker
Sep 22nd, 2009, 11:34 AM
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.

storm5510
Sep 22nd, 2009, 12:43 PM
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?

JuggaloBrotha
Sep 22nd, 2009, 01:35 PM
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.

Jenner
Sep 22nd, 2009, 03:32 PM
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.

Shaggy Hiker
Sep 22nd, 2009, 04:27 PM
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.

storm5510
Sep 22nd, 2009, 05:11 PM
I turned the checks off. No difference in speed.

I found the setting for turning off the news channel also.

Shaggy Hiker
Sep 22nd, 2009, 06:22 PM
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.

dilettante
Sep 22nd, 2009, 07:52 PM
... 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.

storm5510
Sep 22nd, 2009, 08:10 PM
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.

JuggaloBrotha
Sep 23rd, 2009, 07:51 AM
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".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.

Jenner
Sep 23rd, 2009, 09:48 AM
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.

chris128
Sep 23rd, 2009, 10:02 AM
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.

Jenner
Sep 23rd, 2009, 02:00 PM
You know, I didn't know about that! That makes total sense since the code I had executing was in the Form Load event! Gah, hope that one is fixed in Windows 7. I eagerly pick up my copy on the 12th. :)

chris128
Sep 23rd, 2009, 02:05 PM
I think it might only be 64 bit editions but not sure... either way its a pain in the ass

Shaggy Hiker
Sep 23rd, 2009, 02:13 PM
I hope to be installing Windows 7 Ultimate this evening. We'll see what interesting problems I encounter after that.

storm5510
Sep 24th, 2009, 12:17 PM
I hope to be installing Windows 7 Ultimate this evening. We'll see what interesting problems I encounter after that.

This is something I do not plan on doing. If I did, I would have to toss out my scanner, printer, TV tuner card, and no telling what else. I downloaded a compatibility test app from Microsoft. This is where I got the info from.

Shaggy Hiker
Sep 24th, 2009, 12:28 PM
Tossing out the TV would be a good thing. It takes you away from coding, and for what?

chris128
Sep 24th, 2009, 12:43 PM
This is something I do not plan on doing. If I did, I would have to toss out my scanner, printer, TV tuner card, and no telling what else. I downloaded a compatibility test app from Microsoft. This is where I got the info from.

I wouldnt rely too heavily on that thing - the best thing is to just check the website of the manufacturer for each device and see if they have an option to download a Windows 7 driver for your device (or even Windows Vista as I believe Windows 7 is built to be compatible with pretty much anything that runs on Vista)

Jenner
Sep 24th, 2009, 02:29 PM
Only thing I'd have to toss is my scanner. I don't think Canon made Vista drivers for my model CanoScan. Shame since it would be the second scanner I'd have to toss, my first one I tossed when I went from 98se to 2000. I really liked that beast too.

JuggaloBrotha
Sep 24th, 2009, 04:00 PM
Only thing I'd have to toss is my scanner. I don't think Canon made Vista drivers for my model CanoScan. Shame since it would be the second scanner I'd have to toss, my first one I tossed when I went from 98se to 2000. I really liked that beast too.I've got a CanoScan scanner two, it's my 2nd one as well. I had to toss my first one when I went from 98se to XP though.

storm5510
Sep 24th, 2009, 05:26 PM
My TV tuner is an ATI TV Wonder Pro. Around 8 years old.

My scanner is an HP Scanjet 4400c. Also around 7 years old.

My printer is an HP Deskjet 930C. It's at least 10 years old. The original driver CD is for Windows 98.

They may all be old, but they work great. Not that much mileage on any. If they were junk, I'd toss them, but they're not.

chris128
Sep 24th, 2009, 06:14 PM
a 10 year old printer :| I'm surprised you could even find a port on the back of your PC to plug that into :P

JuggaloBrotha
Sep 24th, 2009, 08:18 PM
My first scanner used the parallel port but when I went to XP it flat out didn't work, I knew they'd cut a lot of the support for the parallel devices in XP but I didn't know it was that much till I actually used the OS. Now in Win7 my CanoScan scanner is USB but there's prolly no x64 drivers for it so I'm again SOL.

I haven't had a comp with a parallel, serial and/or Com port since 2004

storm5510
Sep 24th, 2009, 08:27 PM
a 10 year old printer :| I'm surprised you could even find a port on the back of your PC to plug that into :P

I ran it as parallel until my most recent computer. No parallel port. The printer has a USB port and that works fine.

My first scanner was SCSI, and expensive! Support for it disappeared when XP came around. The HP is USB.

My new computer has one DB-9 (male) which is a COM port, and a DB-15 (female). Not sure what it is.

Jenner
Sep 25th, 2009, 07:46 AM
DB15 sounds like on-board VGA if it's a triple stack of 5 pins. If it's a double stack of 8x7 pins, I have no idea.

I actually got my scanner working last night by taking a Canoscan LIDE 60 Vista x64 driver and forcing it to be used for my LIDE 35.

storm5510
Sep 26th, 2009, 10:18 PM
DB15 sounds like on-board VGA if it's a triple stack of 5 pins. If it's a double stack of 8x7 pins, I have no idea.

That's very odd. It is a 5 by 3 array, a VGA connector. Nowhere in my board manual does it mention having integrated video. I suppose it really doesn't matter. I've using a DVI cable with my monitor connected to an add-in card.

Jenner
Sep 28th, 2009, 01:58 PM
The port may be standard to the motherboard, but the actual integrated VGA chip may not be present on the board. Leaving a connector on a board is a slight cost waste, but it may be more costly to carry two assembly processes: with and without.

The chip though would be a significant enough cost to warrant not having it on-board though.

storm5510
Sep 28th, 2009, 10:49 PM
The device manager lists two video adapters. So, that suggests the chip is there. I looked at the manual again, in more detail. There is a reference to the connector. "Connect your monitor here." That's all it says. No descriptions or anything else specific.

dilettante
Sep 28th, 2009, 11:27 PM
Most consumer grade machines come with minimal documentation, often little more than a fold-out poster of pictures showing how to plug what where. You might try the manufacturer's support site. They might offer an actual manual.

storm5510
Sep 30th, 2009, 07:14 PM
This one is not consumer-grade. It is a custom built by me. So, no big glossy posters.

:)