[Mono-dev] mono numerical performance

Jonathan Shore jonathan.shore at gmail.com
Sat Nov 19 20:26:58 EST 2011


Slide, not really.  If mono SIMD had a more general mapping to the GPU, or could operate on very large vectors or matrices, possibly.   Linear algebra is an easy mapping to that stuff.   However, I do more complicated stuff around timeseries, so does not really fit into linear alg stuff.

I guess, what I'm really after is to understand why the unsafe implementation is hardly faster than the "safe" version.   Whereas on the .NET CLR is 2x as fast, and nearly as fast as the C++ implementation.    There is no GC or object creation involved here, just arrays and computations.

On Nov 19, 2011, at 8:19 PM, Slide wrote:

> Is it something that would benefit from Mono.Simd?
> 
> On Nov 19, 2011 6:13 PM, "Jonathan Shore" <jonathan.shore at gmail.com> wrote:
> I write scientific numerical algorithms that are very data / array intensive.  Having recently moved from using the JVM to the Mono CLR, was curious about the pure numerical performance against arrays.   Towards this end, wrote a partial matrix class and driver around it to test performance across C++, JVM (Java), and CLRs (C#) with both safe and unsafe implementations.
> 
> The code is essentially the same across these languages, with the exception that I included an unsafe variant (using pointers), to see what sort of additional performance could be obtained in the CLR.
> 
> On a linux box had the following runtimes (where Java is 1.7 and mono 2.10.6 with LLVM and without (same #s)):
> 
> CPP (Core i7-950):   			01:28:818
> Java (Core i7-950):   			01:31.840 
> Mono .NET (Core i7-950):  	04:01.466 (unsafe, LLVM)
> Mono .NET (Core i7-950):  	04:29.680 (safe, LLVM)
> 
> Notice two things:
> 
> the mono runtimes are ~3x slower than the JVM or C++
> the unsafe implementation offered very little performance improvement (why?)
> 
> So I decided to take a look at the MS .NET CLR on a VM and compare that with a C++ baseline (since the VM is slower):
> 
> CPP (VM): 					 01:56:296
> .NET (VM): 					02:17.359 (unsafe, MS CLR)
> .NET (VM): 					04.03.786 (safe, MS CLR)
> 
> Interestingly, the MS CLR is almost as fast as C++ with -O3 optimisations for the unsafe implementation.    The "safe" implementation is 2x as slow, in line with the idea that the unsafe implementation offers a significant performance advantage.
> 
> The "safe" implementations more or less align in that they are multiples slower than the C++ implementation (3x in the case of mono and 2x in the case of the MS CLR).  The mono implementation of the "unsafe" code shows very little performance benefit.
> 
> So I am wondering the following:
> 
> are there runtime or compile parameters that would increase the performance of the unsafe code?
> is the cost of pinning the arrays expensive?
> is it just a lack of JIT optimisation on the unsafe code?
> 
> I'm enclosing a source project with a csharp, java, and cpp sub-directory.   I hand compiled these, however, there is a sln that will compile the cpp and csharp parts.
> 
> Ideas?
> 
> Jonathan
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20111119/841b398b/attachment-0001.html 


More information about the Mono-devel-list mailing list