Update: 15/01/2010 - It seems that I made big bug in test code for C# which caused decreasing of C# results about factor 10! I assumed that DateTime.New.Ticks returns nanoseconds, but it returns ticks, and in one nanosecond we have 10 ticks... Sadly nobody looked into sources of my tests :-(
So results for C# should be divided by 10, and in this case C# is faster than Java about 3 times [but not Java 1.5 with -server switch used in this case Java is a little faster than C#].
New results for Intel Core 2 Duo T6600 2.20 GHz under 64 bit Windows 7:
C# z .NET 4.0 - 1.17 ms
Java 1.5 with switch -server - 1.096 ms
Java 1.6 with switch -server - 2.8895 ms
Python 2.6 - 10.88 ms
Recently I made tests of this which programming language gives quicker code ;-)
Of course it depends from this what this code should to do.
So I choose thing which I'm writing almost always in new [new for me] language :-)
I wrote it even during my first session, over green screen [on RS232 connection] when I was first time connected to HP-UX on my University server ;-) [or maybe not??? I'm not sure now ;-)]
This thing is simple numerical integration of function f(x)=e-x2 in range (-10,10> [when calculated form minus infinity to plus infinity result is equals to square root from Pi :-), I was really impressed when my professor showed it to us on our lecture from mathematical analysis]. Those calculations are performed in 10000 of steps, and repeated 1000 times for stable result [so we measure time of 1000 iterations from 0 to 9999] and divide result by 1000 to get information about time needed to calculate one iteration.
And results are interesting ;-)
C++ 32bit - 0.985 ms
C++ 64bit - 1.387 ms
Java 64bit - 3.8 ms
Java 32bit - 4.7 ms
Google Go 32bit - 8.521 (5.68) ms
Python 2.5.2 32bit - 10.3 ms
Python 2.5.4 64bit - 10.16 ms
C# 64bit - 14 ms
C++ code was compiled with Visual C++ 2008 Express Edition [for 64 bits I used compiler from Windows 7 SDK, here instruction how to make Visual C++ 2008 Express Edition to use it :-)]
Result of Go wasn't so surprising, now after the premiere of this language we can here only praises, but its still experimental thing, and I used 32 bit version of compiler which isn't the best ;-) [I must also admit that after my first experience with Go I don't like it and I hope this one Google project will die].
I think that good advice after this test is ;-) If you need to write some very quick code use C++, if it must be fast but needn't to be extremal fast - use Java, and newer use C# ;-)
How to detect clickbaits?
Calculation of SSD life time in EEE PC
Sources of JPC - x86 emulator in Java
Recursion is evil ;-)