Actionscript vs Playscript(compiler) vs C#(Monotouch) vs ObjC

This is the test to check relative difference in performance on mobile device.

I compared:

  • Actionscript 3 code compiled with ASC2 (AIR 3.6)
  • Actionscript 3 code compiled with Playscript-mono compiler
  • C# code compiled with Playscript-mono compiler (Monotouch)
  • Objective C code

Results (on iPad 3):

  • AS3 (ASC2) – 390 milliseconds
  • AS3 (Playscript) – 810 milliseconds
  • C# – 800 milliseconds
  • ObjC – 460 milliseconds

Objective C

C#

Actionscript 3

7 Comments

  1. pro

    Could you please add Haxe to your benchmark?

  2. Ed

    So, asc2.0 is faster then ObjC???
    Do you try to test +,-,*,/,sqrt?

    • ingwe

      Well, I do not think so. First of all, the test is very synthetic and does not represent real-world situations. I just wanted to perform very general quick test, to get the overall idea of performance between Actionscript and Playscript (and others are for reference). Plus, I am not ObjC developer, and my sample code may not be optimized (for example, i found out that the performance of that ObjC code can be much slower/faster depending on the way you declare variable). But I believe that ASC2 is very optimized for simple Math computations.

  3. Why in C # and ObjC versions there is an impression (and cast) the value and AS3 version will not even be output?

    • ingwe

      I am not sure I understand you. I see no casting in the code. As to the output in AS3 version – the output is saved in “time” variable, which can be accessed in any way you want (you can trace it or put into label).

      • dto

        …i think he refers to the EXTRA call in
        Objective-C
        self.myLbl.text = [NSString stringWithFormat:@”%f”, timePassed_ms];

        C#
        myLbl.Text = myDateResult.TotalMilliseconds.ToString();

        To make it fair, why not do a
        AS3
        var string_Time:String = time.toString();

        to have that extra call in AS3?

        Or to remove the extra calls from C# and Objective-C, and get the result from outside the function cos?

    • ryan

      I dont think it matters as the impression (and cast) happen after the time is calculated. Using the value elsewhere will not change the value.

Leave a Comment