Eccentric Developments

Raybench - C# (PLC pt.5)

As the poster child of the NET framework created by Microsoft, C# is a very widely know programming language. Characterised for being object oriented and having a syntax similar to other C-like languages.

Initially only being able to run under windows, it was later supported on other operative systems thanks to the Mono initiative by Xamarin.

C# has many libraries and superb support from Microsoft and third parties, making it the language of choice for enterprise programming and windows software in general.


Tests where run using mono 3.2.8.

Compilation time

$ time mcs csrb.cs

real	0m1.895s
user	0m1.788s
sys	0m0.084s

As shown, compilation time is fast and can be compared with node.js loading and parsing time. Although is more than twice as slow than GCC, the difference is barely noticeable.

Running time

$ time mono csrb.exe 

real    12m18.463s
user    12m0.392s
sys     0m11.488s

Well, this is a surprise, not only it's running time is much higher than C, it is around 40% higher than JavaScript!. Kudos to the V8 engine's programmers.

Code metrics

Lines count: 284 code, 69 blank, 353 total. File size: 7586 bytes.

General Thoughts

While I wasn't expecting .NET runtime to be a record setter for running speed, it was really surprising to see it being surpassed by JavaScript code running on top of node.js.

What I would like to further investigate is what causes this difference in efficiency, I suspect the culprit might be the garbage collector; but that will have to happen another time.


You can follow the development of this project on GitHub:

Enrique CR - 2016-05-26