C# vs VB.NET

  • Thread starter Thread starter Adam J. Schaff
  • Start date Start date
A

Adam J. Schaff

My boss's boss has heard a rumour that C# is faster than VB.NET and is now
concerned because we are writing stuff with VB.NET. My first reaction is
that this is absurd. They both compile to the same IL, right?

Now I've done a little C#, but on the whole I suffer from curlybraceaphobia,
so I'm looking for amunition to defeat his claim. Can anyone point me to an
article or anything official looking that states that neither language is
faster than the other?
 
Both languages compile against the same CLR.. We work with C# and VB.NET, we
have seen no difference so far..

VJ
 
but on the whole I suffer from curlybraceaphobia,

lol. Sounds like your boss suffers from "non-curlybraceaphobia" ;)
They both compile to the same IL, right

Yes, but the VB compiler might generate different IL than the C# compiler in
different situations. This results in C# being slightly faster under some
conditions and VB being slightly faster in others.

This is an old an tired argument IMHO. Any performance differences between
the managed languages will unlikley have any affect on a real world
application. The single most important factor in writing an application that
performs well is a good design written by someone who understands not only
what has to be done, but also understands where performance bottlenecks are
likley to reside. Your boss doesn't seem like this kind of person in my
opinion.

I can't think of any articles off hand, but I'm sure you'll find all sorts
of biased articles (and performance samples out there) that have no
real-world. If your application performs badly when written in VB, porting
it to C# will not make it faster.

Just my 2p,

Trev.
 
I can't think of any articles off hand, but I'm sure you'll find all sorts
of biased articles (and performance samples out there) that have no
real-world.

bolt the word "relevance" on to the end of that sentence ;)
 
If you write VB.NET code with Option Strict On, there's no discenable
difference. There are subtle (Emphasis on Subtle) differences here and
there, but they aren't totally in favor of one language over the other. Dan
Appleman and many others have written on this and have documentation to
support it..

If you don't have on Option Strict (which is code for saying Option Slow
On), then there are bid differences, but that's not the fault of the
language (except for the fact VB.NET has it off by default).
 
Hi Adam,

VB.net has extra above C# the Microsoft.Visual basic functions.
(Mostly string functions) We did more times tests in this newsgroup.

Those functions are mostly faster than so called System methods. (both are
dotNet)

But the differences are only if you have really a very big amount of string
comparising in your programs.

For that you can say VB.net is faster than C# because for the rest they both
use the same dotNet code (when I forget the unsafe code which you probably
not want to use for your applications but which is possible with C# and not
with VB.net it is an extra, you do not need to use it in C# only if you go
deep in the operating system)

There has been a big discussion in this and the C# newsgroup last week from
a site where was a comparising between the two codes. (I thought that he was
in this newsgroup not complete anymore, but it is complete in the C#
newsgroup)

In the begin the people from the C# newsgroup act the same as Sven Rutten,
at the end they took it back. Most opinions say than can be a difference,
but it is not measurable. Have a look at it, because there are links in that
also.

I hope this helps

Cor
 
Hi Bill,

That I did not want to write, but true of course, maybe extra to write that
option Strict off is typical for upgrading from VB6 and that those people
who do not change that, have slower programs than when it was new written in
C#. (or VB.net)

Cor
 
Don't let him find out VC++ runs about three times as fast as either of them. C# runs probably in the range of 10% to 15% faster from everything I've read.
 
* "Adam J. Schaff said:
My boss's boss has heard a rumour that C# is faster than VB.NET and is now
concerned because we are writing stuff with VB.NET. My first reaction is
that this is absurd. They both compile to the same IL, right?

Yes -- it's absurd. If you are good at VB.NET, you will be able to
write programs which run as fast as the well-written C# "pendant". If
you write bad code, both applications, written in VB.NET or C#, will be
slow.
Now I've done a little C#, but on the whole I suffer from curlybraceaphobia,
so I'm looking for amunition to defeat his claim. Can anyone point me to an
article or anything official looking that states that neither language is
faster than the other?

Do you know any article saying that C# is faster? I know one article,
the link was posted some days ago, but the benchmarks were not
well-done.
 
Hi Sean,

I do not believe that a SQL server bound internet application works 3 times
faster with VC++ than with whatever other language. (I also do not say it is
not).

If you say it is, it says more about you than about your answer.

Just my thougth

Cor
Don't let him find out VC++ runs about three times as fast as either of
them. C# runs probably in the range of 10% to 15% faster from everything
I've read.
 
Come on now, that's kind of Apples and Oranges though....=) You are no longer discussing the speed of the language, you are talking speed of external factors. Write a good search algorithm in all three and come back and tell me VC++ it isn't three times faster. On the whole, the language's computational speed usually isn't the limiting factor in speed I will agree wholeheartedly, but that wasn't the question....=

Sean
 
Hi Sean,

I am glad that we agree.

(Only the question was wich is the fastest, for me that is more complex than
only a partial speed in processor memory operations, but it can be that I
read it in another way than you).

:-)

Cor
Come on now, that's kind of Apples and Oranges though....=) You are no
longer discussing the speed of the language, you are talking speed of
external factors. Write a good search algorithm in all three and come back
and tell me VC++ it isn't three times faster. On the whole, the language's
computational speed usually isn't the limiting factor in speed I will agree
wholeheartedly, but that wasn't the question....=)
 
Thanks to everyone who answered. It seems like this is a hot topic! I was
able to locate a thread on the csharp newsgroup that goes into this in
depth.

I really wish the guy who wrote that article had taken a closer look at his
own findings and tried to explain them before just posting it as "the
answer". VB.NET looked bad because he didn't use the framework's built-in
stream classes for I/O. While it is interesting and even useful to learn
that the stream classes are faster than the backwards compatible I/O
functions, it has nothing to do with whether VB.NET is slower or faster than
C#. [Grumble, grumble, rant, rant, rant.]

I would like to see MS officially rebutt some of these attacks on VB.NET. It
would be handy to have something to point to when a customer tells me "Well,
I like your program but why did you write it in VB.NET? I heard that it's
slower than C#."

Oh well.
 
Hey, they are customers. Just do what the sales people do...look them straight in the eye and just make something up.

----- Adam J. Schaff wrote: -----

Thanks to everyone who answered. It seems like this is a hot topic! I was
able to locate a thread on the csharp newsgroup that goes into this in
depth.

I really wish the guy who wrote that article had taken a closer look at his
own findings and tried to explain them before just posting it as "the
answer". VB.NET looked bad because he didn't use the framework's built-in
stream classes for I/O. While it is interesting and even useful to learn
that the stream classes are faster than the backwards compatible I/O
functions, it has nothing to do with whether VB.NET is slower or faster than
C#. [Grumble, grumble, rant, rant, rant.]

I would like to see MS officially rebutt some of these attacks on VB.NET. It
would be handy to have something to point to when a customer tells me "Well,
I like your program but why did you write it in VB.NET? I heard that it's
slower than C#."

Oh well.
 
conspiracy theorist?
i have this eerie feeling that MS is gonna sell us (vb mortals) all out real soon. sooner or later we all have to deal with our own curlybraceaphobia.
 
Hey, they are customers. Just do what the sales people do...look them
straight in the eye and just make something up.

lol. Reminds me of another story...

One day the manager comes to the Software Developer with a new project. The
Software Developer figures it'll take 5 months to do, but tells the Manager
6 months just to be on the safe side.

The Manager figures that the Developer built in a safety margin, so takes a
month off and tells the Sales manager it'll be ready in 5 months.

The sales manager turns around to the customer and says that the finished
product will be ready in 2 weeks.
 
Trev Hunter said:
lol. Sounds like your boss suffers from "non-curlybraceaphobia" ;)

More likely he is just a curlybraceaphile (always avoid the
double-negative).

/Al
 
Trev Hunter said:
straight in the eye and just make something up.

lol. Reminds me of another story...

One day the manager comes to the Software Developer with a new project. The
Software Developer figures it'll take 5 months to do, but tells the Manager
6 months just to be on the safe side.

The Manager figures that the Developer built in a safety margin, so takes a
month off and tells the Sales manager it'll be ready in 5 months.

The sales manager turns around to the customer and says that the finished
product will be ready in 2 weeks.

This, in turn, reminds me of an incident in my working life. It took place
in the mid 1970s so we are talking history, but some things never change.

I was a Developer. We were bidding on a project that was rather complex.
There was only one other development company in the bidding. I gave the
customer an honest estimate that the project would take 12 months to
complete. (The salesman didn't get in the way because I talked directly to
the customer.) The competitor said they could complete it in 2 months. I
pointed out to the customer that this was an unrealistic estimate -- there
was no way it would be completed in that time.

The competitor got the contract.

After a year had gone by, the customer contacted us again saying that the
competitor was still working on the project -- it was buggy. They wondered
if we could take over that job and asked for an estimate as to how long it
would take to do a replacement project. As you might guess, I told them
that it would take me about a year. They, of course, balked. They said
that it couldn't possibly take a year because I had the existing 12 months
of effort by the competitor to base my work on.

The competitor promised that only a further 2 months of effort would be
required and the job would be done. They wondered if I could take over the
competitor's and finish it. I took a look at their solution and gave them
an estimate of 12 months. This realistic estimate was based on needing to
rip the existing mis-designed solution apart and really do it all over
again.

Again they decided to let the competitor "finish."

Another year later they _still_ didn't have a completed project. And so it
goes.

====================================

The Development company that lies and claims a low time estimate gets the
contract and can then extend it indefinitely. The company that is honest
about how long it will take doesn't get the work. Our sales staff learned
this lesson perfectly and in selling my services began to cut my estimates
to 1/3 to make them palatable to the customers.

Remember, the point of the salesman is to get the contract.
 
Back
Top