Copy link to clipboard
Copied
Lately I've been experimenting with porting my chess engine (SparkChess) from AS3 to Javascript via TypeScript.
The app has been in development for 6 years and its AS3 performance is fully optimized. All important functions were benchmarked and analysed at bytecode level, I discussed performance tips with Adobe engineers and I tested various approaches to find the fastest way.
I was quite surprised to see that the Javascript performance in Chrome is almost double than AS3. It starts slower but after a few iterations, the speed increases dramatically.
I'm not publishing numbers because it's not a 1:1 test yet, but the results so far are consistent.
Of course, Javascript has a number of disadvantages - Canvas-based UI is a kludge, script execution timeout varies across browsers and it's difficult to control (the engine needs time), support for some modern features is limited to newest browsers, code and assets are easy to steal, etc. A JS-based SparkChess would be a step backwards.
Still, I'd love to see some visible speed improvements in AS3. I know VM design is hard, I just hope there's still enough interest at Adobe in this area.
Copy link to clipboard
Copied
The final results are in.
I conducted a full deterministic 1:1 test, making sure that at every step the values are the same between engines.
Javascript in Chrome 42 is 254% faster than Flash Player 14.
My test uses a lot of Vector.<int> reading, bitwise operations and of course recursivity, but there's no complex Math functions involved.
Copy link to clipboard
Copied
As far as I know, Chrome precompiles Javascript in the background, you will not be able to achieve that speed in ActionScript.
Copy link to clipboard
Copied
I wish that Adobe could work on improving the performance!
ActionScript 4.0 would have been a great leap forward to improving performance. At this time, I believe there are no plans to improve the existing ActionScript bytecode execution performance in 2015. This assumption is based on the following facts: Adobe's existing backlog of the ActionScript runtime is way too large to focus on improving performance of custom ActionScript bytecode.
I believe that these are some of the other higher priority items on the existing backlog: