[Mono-list] Mono C# versus Java 6 -server performance

Robert Hulme hulme at ebi.ac.uk
Thu Nov 29 09:50:22 EST 2007


> Then there's the memory usage figures, where Mono is usually smaller.
> Not significantly smaller -- 5x 1.xx times smaller, and 9x 2.xx times
> smaller -- but memory use is important.
I agree memory use is generally important, and C# Mono seems to do 
better in this regard. In our situation it isn't the key issue however, 
I care more about CPU time.

> So the speed is fairly comparable (except for pidigits and regex), while
> requiring less memory.  This isn't a Java blowout; this is a tie.
A tie?

Here are the results:
regex-dna, Java 7.9x faster
pidigits, Java 6.1x faster
sum-file, Java 2.5x faster
mandlebrot, Java 2.2x faster
spectral-norm, Java 1.9x faster
startup, C# Mono 1.9x faster
fannkuch, Java 1.6x faster
n-body, Java 1.8x faster
binary-trees, Java 1.3x faster
k-nucleotide, Java 1.3x faster
thread-ring, Java 1.2x faster
fasta, Java 1.2x faster
recursive, Java 1.1x faster
nsieve-bits, Java 1.1x faster

nsieve, Equal performance

partial-sums, C# Mono 1.7x faster
reverse-complement, C# Mono 1.2x faster

Even if you cut off the two top results Java is generally faster. Is it 
significantly faster in those cases? We could argue about what is 
significant and what matters (personally I do most of my work in Ruby, 
so 'speed' usually doesn't matter to me), but when we're wondering which 
language (out of Java and C#) to use for the software we write here 
(that is CPU bound) 30% slower is significant.

If the answer is "Well Java 'cheats' by having special native libraries 
for what is done in these benchmarks" that's an understandable answer, 
or if the answer is "The C# implementation for benchmark foo is not very 
good, we could make a better one", that'd also be reasonable.

Take Mandelbrot for example. From my limited check of the .java and .cs 
implementations they look pretty comparable, so why is the Java version 
over twice as fast?

> In which case performance isn't the issue.  The issue is frameworks and
> experience.  C# may be a nicer language, but if your team is made up
> primarily of Java developers then you should probably stick with Java.
> Similarly, if Java has an available framework for your problem domain
> that .NET doesn't have, then Java may be a better choice.
No, performance is an issue. Java and C# are reasonably comparable 
languages. Good developers can write for either. I am personally of the 
opinion that C# is slightly nicer (maybe more than slightly), and I 
don't see why an equivalent program in C# should be any slower than the 
Java equivalent. Indeed everything I read about CIL (admittedly from the 
Microsoft Press books) suggests it should be easier to create faster 
execution from CIL compared to Java byte code.

-Rob



-- 
I did say something along the lines of "C makes it easy to shoot 
yourself in the foot; C++ makes it harder, but when you do, it blows 
your whole leg off."
--Bjarne Stroustrup


More information about the Mono-list mailing list