Attention: We are retiring the ASP.NET Community Blogs. Learn more >

.NET 2.0 and Java 1.5 for numerical computing

Going ahead with my numerical algorithms translation, I started to wonder if I was going to win something in performance. Is .NET 2.0 going to be faster than Java 1.5 for numerical computing? To find out, I downloaded the SciMark2 benchmark from the http://math.nist.gov site and I translated it to C# using Visual C# Express, at this point I didn't try to understand (let alone enhance) the code, only to get it working in C# (except a couple of obvious changes like using Array.CopyTo() to copy arrays). Anyway, these are the results I got with Java 1.5 Beta 2 in my portable (2.8 GHz Mobile Intel Pentium 4 CPU):

Composite Score: 207.78646505369562
FFT (1024): 112.99822846954115
SOR (100x100):   378.42792716276983
Monte Carlo : 47.71337303709922
Sparse matmult (N=1000, nz=5000): 144.6072353535397
LU (100x100): 355.1855612455282

And these are the results I got with .NET 2.0 Beta 1:

Composite Score: 320.261977294581
FFT (1024): 225.063751509717
SOR (100x100):   395.271584950618
Monte Carlo : 18.592932017316
Sparse matmult (N=1000, nz=5000): 484.889267269725
LU (100x100): 477.492350725527

The results are in Mflops so Whidbey seems to be roughly 50% better than Tiger. Of course, these results are very preliminary and they will vary from machine to machine, so you can download the C# SciMark2 from http://www.logicstudio.net/Net2005/SciMark2.zip (the translation is awful right now and barely use C# idioms but, hey, it runs!) Give it a try and let me know how it goes.

Doing benchmarks is always dangerous, and doing it with betas even more so, so I run the benchmarks with Java 1.4.2_05 and got this:

Composite Score: 212.73680429939608
FFT (1024): 107.32467730480086
SOR (100x100):   376.06459421216255
Monte Carlo : 46.94569063386169
Sparse matmult (N=1000, nz=5000): 146.67860553090557
LU (100x100): 386.6704538152499

And with .NET 1.1.4322:

Composite Score: 336,152586167483
FFT (1024): 236,507205423729
SOR (100x100):   405,674738526316
Monte Carlo : 25,873449174941
Sparse matmult (N=1000, nz=5000): 476,624132235073
LU (100x100): 536,083405477354

For both platforms the production versions are better than the betas but note I run the tests in the same machine but with *different* Windows XP installations so don't jump into conclusions. In any case the difference between Java and .NET seems to be consistent.

3 Comments

  • can you please explain what the numbers in the test mean ??

    in english

    which one is faster ???

  • Interesting numbers, Edgar! As a developer of numerical software for the .NET platform, I've found that there is a significant performance gap between native and managed code. For matrix operations in particular, the picture gets bleaker as the size of the matrices increases. A factor of 10 is not unheard of for orders > 100.



    The good news is that you can use optimized native code from .NET at minimal cost. This gives you the best of both worlds: blazing fast code and blazing fast development. :o)

  • Hi Jeffrey, personally I'm more interested in maintainability (but hey, I perfectly understand the need for high performance), that's why I'm interested in things like OO-Blas or OO-LAPACK, anything along those lines?

Comments have been disabled for this content.