Friday, May 30, 2008

Shootout: C# .NET vs Java (Benchmarks)

The Computer Language Benchmarks site has benchmarks comparing different languages. It includes C# Mono vs Java but not C# .NET vs Java. So I went through all the benchmarks and here are Java vs .NET results on my computer (3 core phenom + Windows Vista). The command line arguments used were not exactly same as those used by shootout site. For example, they use 16as a command line argument for binarytrees benchmark, but that's too fast on my computer, so I used 20 etc.

All the benchmarks can be downloaded from:

The options used for java were: -server -Xms64m, i.e:
java -server -Xms64m binarytrees 20 > \NULL

(Shorter graph is better in all cases below)

The implementations on shootout site are not exactly same for different languages. Some of the C# implementations can probably be optimized (and probably some of the Java ones too).