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:
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:
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 |
benchmark.tar.gz
Description: GNU Zip compressed data
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list