Struct Performance 2013

After a long hiatus I’ve updated my .NET Struct Performance benchmarks with results for the latest batch of C#, C++, Java, and JavaScript compilers. As expected I needn’t have bothered with the first three – C++ and Java are as fast as ever, and C# is sadly as slow as ever, even in this test originally intended to highlight one of its strengths.

Some interesting changes did happen in the JavaScript world. Of the three major browsers, only Firefox’s JavaScript engine has been stagnant, though on a high level – about 3× slower than Mono. Internet Explorer 10 did make massive improvements over IE9’s laughably slow JavaScript engine, roughly doubling its performance, but that’s still not good enough to lose its last place in the field.

The big surprise was Chrome which made huge strides from version 16 to 24, more than doubling its already solid performance. Chrome now comes within 50-80% of Mono in equivalent tests, and actually beats its two worst results! Mono itself is considerably slower than Visual C# or Java, but that doesn’t seem to bother many developers. So assuming the other browser makers can eventually match Chrome, this should also weaken execution speed as an argument against JavaScript or derivatives like TypeScript.

All the worse from a C# developer’s perspective, as I can’t help but add. TypeScript is the new creation of C# designer Anders Hejlsberg, and Microsoft as a whole has conspicuously shifted its focus from C# and .NET to C++ and JavaScript. Better JavaScript performance also means that the excellent C# language will go that much faster into the dustbin of forgotten programming languages. Say hello to Ada and Modula-2 for me!

5 thoughts on “Struct Performance 2013”

  1. As for C# go to the “dustbin of forgotten programming languages: It seems that there many interesting things are being developed at MS nowadays… Rumors has it that they are building a native code compiler for C# and there are some evidence for this on the net, so, i rather do not believe that they have abandoned anything C#-related. (And how they could ? C# is one of the best things they ever created)…Have a look at–Not-in-incubation-but-for-production-

    Native C# is already happening in the code that is running on Windows Phone 8 (and 7.8) with their Cloud Compiler technology:
    There is not JIT there but code is AOT (ahead of time) compiled, as Xamarin does it on their MonoTouch solution for iOS. If they are indeed building something like that for the desktop too, they will have the *ultimate* combination: A beautiful, well thought-out and elegant language (C#) that compiles to native code. with all the benefits that this brings to the table.

    And why TypeScript has to be an answer for anything ? Do you, seriously, believe that developers/engineers will suddenly leave that “excellent C# language” and go back to C++ or, worst, to JavaScript even if Microsoft wants them to?? I certainly do not believe so…

    If you have already C# expertise, i suggest to wait: This year will unveil many things Microsoft-related…

    1. The native C# compiler certainly sounds interesting but that’s from last May and I haven’t heard any news since; besides, it would be Windows only. Those cloud compilation services are great while they work… but if Xamarin goes out of business or turns off its cloud you’ll have to rewrite your iOS app in Objective-C because Apple doesn’t allow 3rd party runtimes on iOS devices.

      Regarding Typescript and similar efforts, the idea is that you won’t have to write JavaScript but a better language that’s closer to C#. Yet your program can still can run on any JavaScript engine, without external support like another runtime or cloud compilation. If they can get decent performance and library support for that I’m all for it.

  2. cnahr,

    Xamarin is not using cloud compilation, Microsoft does. Xamarin uses AOT compilation right in your dev box, i am using MonoTouch and i have built an app this way (which, by the way, was featured by Apple in AppStores all over the world).

    Of course you are correct in that if Xamarin goes out of business, anyone who is using their products is doomed.

    As for TypeScript, i fail to see when it will have the power that C# has right now. The smart move for Microsoft would be to indeed give us that native code compiler…

    1. Thanks for the clarification, I misunderstood your comment and thought Xamarin also used cloud compilation.

      No question C# is currently a better choice than fledgling TypeScript. Consider that C# compiles down to very simple MSIL, though — there’s theoretically no limit to what you could build on JavaScript, perhaps with some compilation hints passed through to new JS engines. For the longest time I didn’t think that anything JS-based could be viable for real applications, but there’s a ton of effort being poured into the HTML/CSS/JS platform and the results are showing already. Who knows where it will be in a year or two?

  3. I have played a little with TypeScript, the fact that the great Anders Hejlsberg is the mind behind it, it was enough for me to check it out. Sure, it is compelling and Visual Studio’s support is really swesome but unless i see it to be able to build desktop software and not just web apps (win8 app store excluded) i do not see any real value in it, at least for now.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.