I have always heard that C++ was faster than C#.

So I decided to do a test on which could count to 10000000 faster using a for loop.

And amazingly C# does it much faster.

For the test i made 2 really basic console applications. One in C# and one In C++.

ChallengeCS.exe Source: C#
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CallengeCS
{
    class Program
    {
        static void Main( string[ ] args )
        {
            for( int i = 0; i <= 10000000; i++ )
            {
                Console.WriteLine ( i.ToString ( ) );     
            }
            Console.ReadLine ( );
        }
    }
}
And i also made sortof the same thing in C++.

Code:
#include <iostream>

using namespace std;

int main()
{
	for (int i = 0; i <= 10000000; i++)
	{
		cout << i << endl;
	}
	cin.get();
}
Anyone know why C# is completing this faster?

I made a video so you do not have to compile these yourselves.

http://s287.photobucket.com/albums/l...rrent=Test.flv

The one on the right is C#, the other is C++.

Let me know what you think if you know why C# could be completing first?