[Mono-list] mono performance, 20x differential with Java (what am i doing wrong)

Rolf Bjarne Kvinge rolflists at ya.com
Fri Jan 29 11:30:00 EST 2010


Can you post the source code for the java sample? I have a hard time
understanding how the sample can run so fast with java, here I get the
following results:

C#: 3.346 seconds
C (compiled with gcc –O3, see attached source code): 1.132 seconds


>I'm quite familiar with both the .NET and Java development environments,
but only recently have begun to experiment with mono, so forgive me if I'm
not clued-in.   
>I specialize in numerical work that often involves a lot large-scale array
manipulation for linear algebra, timeseries, etc.    My main production
platforms are OSX and Linux.   I've been doing most of my work on the JVM
over the >past few years, though spent a couple of years with .NET when it
was pre-release / pre-1.0.  
>My main interest is in Ocaml, particularly the F# variant as the basis for
my numerical work.
>One of the first things I do when considering a platform is run benchmarks,
as performance is critical for what I do.    Starting with C# I wrote a test
to gauge the array-access overhead associated with the platform.  Without
>knowing how to tweak the mono runtime to turn on any particular
optimisations, the results were quite poor for this specific test (see code
at the end of this posting).
>The test on my MacPro 2.6 Ghz / Snow Leopard with mono 2.6.1 gave the
result of:
>	16 sec, 130 ms for 1000 iterations
>the same code, modified just for IO, etc on the Java VM (without -server)
 gave a runtime of:
>	 0 sec, 831 ms
>changing the # of iterations to higher amounts did nothing to improve the
ratio.   Java is 20x faster in this benchmark.
>I could not find any documentation concerning settings for the -optimize
flag on the mono VM, so perhaps there is a setting I should be using.   
>Secondly, I saw the posting concerning the optional use of LLVM.  I have
not been able to build mono on OSX as am having problems building glib.  I'm
wondering whether anyone has a packaged up version of glib or better a
packaged up >version of mono with LLVM enabled.
>I have heard only good things about LLVM performance, so hoping that this
will help address this gap.   Hopefully I am doing something wrong here and
the performance is much closer.   Test code below ...

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: a.c
Url: http://lists.ximian.com/pipermail/mono-list/attachments/20100129/160af26b/attachment.c 

More information about the Mono-list mailing list