Quote: |
Uhh... i did not say that switch to C. C++ is similar enough with C# and whatever they say ... C++ does calculations about 5 times quicker than C#.
|
You got me curiuous. I had always heard C# was approx the same speed, but never done any research on it. I did a little code test to see what my results were. I wrote a simple console app in C++ and C# to do this:
double d1 = 0.727272;
double d2 = 0.26252;
double d3 = 343432.232;
for (int i = 0; i < 100000000; i++)
{
d3 = d1 * d2;
d1 = d3 * d2;
d2 = d2 * d2;
d3 = d1 * d2;
d3 = d3 * d2;
}
The C# time was between 595 ms and 607 ms. The C++ time was between 594 ms and 598 ms. That doesn't quite seem like a factor of 5 difference to me.
Obviously the more complicated the code the more crap C# is going to throw on top of things (like in Windows forms and using complicated data structures), but the language speed itself is equivalent in speed for doing raw calculations.