Hi,

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 ...

regards

Jonathan
--
http://tr8dr.wordpress.com/


using System;

namespace Performance
{

        public class ArrayTest
        {
                
                public static double test1 (double[] vec)
                {
                        double sum = 0;
                        for (int i = 8 ; i < vec.Length ; i++)
                        {
                                vec[i] = 2*vec[i] - vec[i-1];
                                for (int j = 1 ; j < 8 ; j++)
                                        sum += 1.3 * vec[j-1];
                        }
                        
                        return sum;
                }

                public static void Main (string[] argv)
                {
                        int iterations = argv.Length > 0 ? int.Parse(argv[0]) : 
1000;
                        
                        double[] vec = new double[100000];
                        for (int i = 0 ; i < vec.Length ; i++)
                                vec[i] = i;
                        
                        DateTime Tstart = DateTime.Now;
                        Console.WriteLine ("starting performance test on " + 
iterations + " iterations");
                        
                        double sum = 0;
                        for (int i = 0 ; i < iterations ; i++)
                                sum += test1 (vec);
                        
                        DateTime Tend = DateTime.Now;
                        TimeSpan Tspan = Tend - Tstart;
                        Console.WriteLine ("ending performance test on " + 
iterations + " iterations, time: " + Tspan.Seconds + ":" + Tspan.Milliseconds);

                        Console.WriteLine ("result: " + sum);
                }
        }
}




_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to