You'd think both are the same.
But maybe it's the compiler that Microsoft has used, but I've noticed that when compiling two very small programs, identical logic. VB.NET uses more IL instructions.
Is it true than that c# must be faster, if only because its compiler is smarter.
C++ was developed by Bjarne Stroustrup in 1979. C does no support polymorphism, encapsulation, and inheritance which means that C does not support object oriented programming. C++ supports polymorphism, encapsulation, and inheritance because it is an object oriented programming language. C is (mostly) a subset of C++.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
<> in some languages means "does not equal". But in c, the operator is != . Also note the difference between logical AND ( && ) and bitwise AND ( & ). You should use the logical operators for multiple criteria in a conditional statement.
C-- (pronounced C minus minus) is a C-like programming language. Its creators, functional programming researchers Simon Peyton Jones and Norman Ramsey, designed it to be generated mainly by compilers for very high-level languages rather than written by human programmers.
The answer is yes and no. It really depends on what specific feature you are referring to. Likewise, there are areas where VB executes faster. I can give an example of each.
This code in VB...
For i As Integer = 0 To Convert.ToInt32(Math.Pow(10, 8))
Next
...is about 100x faster than this code in C#.
for (int i = 0; i <= Convert.ToInt32(Math.Pow(10, 8)); i++)
{
}
It is not that the VB compiler is better at generating code that executes for
loops faster though. It is that VB computes the loop bound once while C# computes the loop condition on each iteration. It is just a fundamental difference in the way the languages were intended to be used.
This code is C#...
int value = 0;
for (int i = 0; i <= NUM_ITERATIONS; i++)
{
value += 1;
}
...is slightly faster than the equivalent in VB.
Dim value As Integer = 0
For i As Integer = 0 To NUM_ITERATIONS
value += 1
Next
The reason in this case is that the default behavior for VB is to perform overflow checking while C# does not.
I am sure there are other difference in the languages that demonstrate similiar performance biases. But, both languages are built on top of the CLR and both compile to the same IL. So making blanket statements like "Language X is faster than language Y" without adding the important qualifying "in situation Z" clause are simply incorrect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With