Microbenchmarking 3: C#

Posted by pavel Sun, 18 Sep 2005 21:49:33 GMT

I added C# to the list of microbenchmarks I did recently.

C# The C# test were made using Visual Studio 2003, using the default settings for Debug and Release versions. Compared to C++, there is some small performance penalty with the tight loop tests. Matrix multiply is even slower than in Java, ten times slower than in C++. The reason for this is probably the lack of fixed size array types in C#. The benchmark uses so called jagged arrays, the C# lingo for arrays of arrays. I also tried two-dimensional arrays, but they are even slower. This experience confirmed the prejudices I had regarding C#: The language is superflous; between Java and C++ there is no gap this language fills. The syntax seems slighly more cumbersome than in Java, if you e.g. look at the initializers for jagged arrays. The .NET class library seems to be ok at first glance, e. g. DateTime is based on a 64 Bit value containing 100-nanosecond intervals that have elapsed since 12:00 A.M., January 1, 0001. The range will last for more than 50,000 years, the resolution can be used also for profiling and realtime computation purposes, even if I would have preferred at least one nanosecond resolution.

Windows:

LanguageLOOPCALLMAT4
Scheme MIT Rel. 7.7.1
(interp.)
7300005600008000
Ruby 1.8.02.7Mio.1.4Mio.12000
JavaScript3.1 Mio.1.8 Mio.20000
Python 2.34.5 Mio.2.1 Mio.52000
Perl 5.8.08.5Mio.1.4 Mio.23000
Lua8.7 Mio.4.3 Mio.23000
Scheme MIT Rel. 7.7.1
(compiled.)
3 Mio.
-60 Mio.
3.2 Mio.
-70 Mio.
67000
Spike-A30 Mio.6.5 Mio.n.a.
Spike-B112 Mio.19 Mio.2.5 Mio.
Java -Xint.Sun 1.5.0_04-b0587 Mio.22 Mio.160000
Java JITC Sun 1.5.0_04-b05 260 Mio.52o Mio.2.3 Mio
C++ Debug270 Mio.11 Mio.(!)4.2 Mio
C# Debug1400 Mio.180 Mio.1 Mio
C# Release1400 Mio.1200 Mio.1.5 Mio
x86-Asm2100 Mio.n.n.n.n.
C++ Release#inf#inf14 Mio.

You can find the C# source here:

The other sources were already published here:

Trackbacks

Use the following link to trackback from your own site:
http://aggregat7.ath.cx/trackbacks?article_id=64

Leave a comment

Comments