AS3 vs. JavaScript Performance Followup (April 2013)
It’s been about a year and a half since my last test of AS3 versus JavaScript and there have been several major releases of both browsers and the Flash Player. Today, we pit every major browser against each other and Flash Player itself to get an updated picture of which provides the fastest scripting environment on the web.
Since last time, the following releases have occurred:
Platform | Last Test | Today’s Test |
---|---|---|
Flash Player | 11.1.102.55 | 11.6.602.180 |
Opera | 11.52 | 12.14 |
Safari | 5.0.4 | discontinued |
Chrome | 15.0.874.120 | 26.0.1410.43 |
Firefox | 8.0.0.4325 | 20.0 |
I performed all of these tests in the same environment as last time except for the version of the Flex SDK used:
- ASC 2.0 build 352231 (
-debug=false -verbose-stacktraces=false -inline
) - 2.8 Ghz Intel Xeon W3530
- Windows 7
I assign “points” to each platform based on its performance ranking on each test. There are five platforms in this test, so the first place platform gets five points, the second platform gets four points, and so on. Say there is a three-way tie for first place. In that case, each tying platform gets five points and the next-best platform gets two points and the platform after it gets one point.
Here are the points awarded:
Platform | JavaScript (Firefox 20.0) | JavaScript (IE 10.0.9200.16521) | JavaScript (Chrome 26.0.1410.43) | JavaScript (Opera 12.14) | AS3 (Flash 11.6.602.180) |
---|---|---|---|---|---|
Test 1 | 2 | 3 | 5 | 4 | 1 |
Test 2 | 5 | 3 | 1 | 4 | 2 |
Test 3 | 3 | 1 | 3 | 5 | 5 |
Test 4 | 2 | 1 | 3 | 5 | 5 |
Test 5 | 4 | 4 | 1 | 4 | 5 |
Test 6 | 4 | 4 | 5 | 4 | 4 |
Test 7 | 4 | 4 | 5 | 1 | 4 |
Test 8 | 4 | 2 | 5 | 1 | 4 |
Test 9 | 5 | 3 | 5 | 3 | 1 |
Test 10 | 4 | 3 | 5 | 2 | 1 |
Test 11 | 5 | 3 | 4 | 3 | 1 |
Test 12 | 5 | 3 | 5 | 3 | 3 |
Total | 47 | 34 | 47 | 39 | 36 |
To compare these results to the results from November 2013, let’s look at percentile of each platform’s points:
Product | Last Test | Today’s Test |
---|---|---|
Flash Player | 100% | 77% |
Opera | 79% | 83% |
Chrome | 100% | 100% |
Internet Explorer | 75% | 72% |
Firefox | 91% | 100% |
Google Chrome now shares the #1 rank with Firefox instead of Flash Player. Flash Player has sadly (for AS3 and Flash fans) fallen to the second-slowest rank despite a brand-new compiler (ASC 2.0) and five major releases. Elsewhere, Internet Explorer’s long-awaited major 10.0 release wasn’t enough to keep up with the competition as it continues to occupy last last. Opera improved a little, but it should improve massively soon when it switches to the new “Blink” fork of WebKit in an upcoming release along with Chrome. Sharing a JavaScript engine with the co-fastest browser can’t hurt.
As usual, the above test is only a simple test suite from oddhammer.com and not a comprehensive test of all features under all conditions. As such, I recommend viewing the above results only as a broad perspective on overall performance. For specific performance characteristics, check out the other AS3 and JavaScript articles on this site and stay tuned for plenty more!
Raw data spreadsheets: Open Document Format (ODS) , Excel (XLS).
Spot a bug? Have a suggestion? Post a comment!
#1 by Amit Patel on April 8th, 2013
Thank you for this! I’ve been wondering but was too lazy to run my own tests. :-)
#2 by Smily on April 8th, 2013
Hi, can you post the sources you used for the tests? There are multiple versions on oddhammer.com and some of them are missing.
I’d also be interested in the results of the old non-ASC2 compiler, because oddly enough, it’s faster than the ASC2 one with my raytracer for unknown reasons.
#3 by jackson on April 8th, 2013
Sure, here are the tests I used.
As for testing ASC1, I may add it to the next followup as an alternative platform because of cases like you pointed out: it’s not always generating faster bytecode. Thanks for the idea.
#4 by Smily on April 9th, 2013
Thanks for those! They seemed quite outdated and the times were degenerate often (executing within 0-1ms leads to a big measurement error) to me (especially the MD5 one), so I revised them a bit and got results that might be a bit more telling. I haven’t really optimized much apart from the MD5 class, which was just a straight JS port (replaced Array with Vector, Number with uint and removed “safe addition”, haven’t fully tested it, but it returns the same hash for cupcake ipsum).
I got that some string methods and looping can be faster in browsers, however number crunching and string concatenation (weird results here) are faster in AVM(2).
Results: https://docs.google.com/spreadsheet/ccc?key=0Av4YDog3VfA-dHI5VVFuYVVqb0Nqb0MzdHNMRUViSFE&usp=sharing
Revised source: https://dl.dropbox.com/u/14681/AS3vsJSrevised20130409.zip
#5 by Shawn on April 8th, 2013
I would love to see how AIR compares to Chrome on mobile devices. From my informal testing, AIR is about 6x faster than Javascript, but it was very informal.
#6 by jackson on April 9th, 2013
Mobile testing is tough since there is such a variety of hardware and software. I may still end up doing some since mobile been growing so much in importance. Maybe this is a good first test to port. Thanks for the idea.
#7 by ben w on April 9th, 2013
PLAYER VERSION WIN 11,7,700,165
PLAYER VM VERSION 2.1 SEC CYCLONE
OPERATING SYSTEM WINDOWS 7
> PLAYER MEMORY: 11628 Kb
> PLAYER CLOCK: 31
> TESTS STARTED
TEST 1: 193 ms
TEST 2: 176 ms
TEST 3: 0 ms
TEST 4: 0 ms
TEST 5: 1 ms
TEST 6: 1 ms
TEST 7: 42 ms
TEST 8: 2 ms
TEST 9: 35 ms
TEST 10: 22 ms
TEST 11: 34 ms
TEST 12: 1 ms
> PLAYER MEMORY: 14656 Kb
> PLAYER CLOCK: 647
Those are the times I got on Internet Explorer with FP11.7. Had to manually write them in as cannot copy the text to clipboard in the browser.
PLAYER VERSION WIN 11,6,602,180
PLAYER VM VERSION 2.1 SEC CYCLONE
OPERATING SYSTEM WINDOWS 7
> PLAYER MEMORY: 5004 Kb
> PLAYER CLOCK: 54
> TESTS STARTED
TEST 1: 216 ms
TEST 2: 208 ms
TEST 3: 0 ms
TEST 4: 0 ms
TEST 5: 1 ms
TEST 6: 1 ms
TEST 7: 42 ms
TEST 8: 1 ms
TEST 9: 29 ms
TEST 10: 19 ms
TEST 11: 38 ms
TEST 12: 1 ms
> PLAYER MEMORY: 7396 Kb
> PLAYER CLOCK: 783
Those are the times I got on Chrome with FP11.6. Only the first 2 tests seem to be significantly different.
For js:
test1 – 8 (crap that is fast)
test2 – 567
test3 – 16, 15
test4 – 14, 9
test5 – 3
test6 – 2
test7 – 24 (almost twice as fast)
test8 – 3
test9 – 16 (faster here too)
test10 – 7 (and here)
test11 – 26
test12 – 1
This was on Chrome 25, have yet to upgrade to 26. Will check again when I do.
Interesting stuff! JS seems to have a very fast join operation as well as fast String functions.
Such a shame that as3 has remained fairly stagnant and been overtaken, aside from the introduction of vectors it has seen little in the way of performance tuning that JS has. Soon it’s gonna be time to start using external interface for speed gains haha. :(
#8 by jackson on April 9th, 2013
Thanks for posting your results. I should have mentioned directly in the article, but Flash is performing faster this time in 11.6 than it was last time in 11.1. So there are speedups in these last five versions plus the ASC 2.0 compiler. It’s just that browsers have been optimizing more than Flash Player and have since overtaken it in almost every case.
You joke about
ExternalInterface
, but you know that’s the kind of test I’ll start writing. :) In a way, I’ve already begun.#9 by Mario Klingemann on April 10th, 2013
Thanks for the update! What I would be interested in is a performance comparison of Canvas vs. BitmapData. – I still have hopes that Flash would be faster at least in that area.
#10 by skyboy on April 11th, 2013
Even if it isn’t, Flash does still have Stage3D and I haven’t heard any news regarding WebGL.
#11 by Tangent on April 14th, 2013
While code execution is important, let’s not forget Flash Player is very fast and efficient translating Flash DOM to pixels while browsers aren’t necessary that fast translating HTML DOM to screen pixels. After all, Flash and browsers are UI layer, it is more about the pixels than just sheer code execution.
#12 by IngweLand on April 17th, 2013
You should include the link to the code. I have not managed to find it, even by continuous clicking on “last test”.
#13 by jackson on April 17th, 2013
It’s the oddhammer.com link. You can also get the exact files I used.
#14 by Bob on April 26th, 2013
Thanks for the results!
What chance is there of seeing some Stage3D vs WebGL tests.
#15 by jackson on April 26th, 2013
I may do this, but it’s a pretty limited test right now since IE has no support for WebGL. In the meantime, here’s a test from 2011.
#16 by mmankt on April 28th, 2013
Hey! did you run as3 tests in standalone flash player? i was doing some perf tests in different conditions and running as3 in chrome was always much faster than standalone, (dunno why)
#17 by jackson on April 28th, 2013
I believe I tested in a standalone player. I just re-ran the test on my Mac (see any recent article for specs) and got largely similar results in the standalone player and in Google Chrome. #1 and #2 seem faster in the standalone player but #7 seems faster in Chrome. For more on AS3 performance across different environments, see AS3 vs. AS3.