ActionScript 2 vs ActionScript 3 performance

2019-07-16 01:45发布

问题:

Any benchmarks of Integer, Array, Function, Class, etc, performance in these 2 languages (compilers)?

Comparisons would also be helpful.

回答1:

Since AS3 runs in a different virtual machine (AVM2) than AS2 (AVM) there have been made significant performance improvements with the introduction of AS3. In general, opcode executed by AVM2 runs about 10x faster than similar opcode running in the old AVM. This of course does not mean that everything in AS3 is 10x times faster than with AS2. With the introduction of AS3 all the display functions, or all the typical Flash API's, haven't increased in speed only the logic and arithmetic part of the code execution process. E.g. applying a blur filter on a visual element is just as fast with AS2 as it is with AS3 however, doing 3D transformations is much faster with AS3. AS3 introduces also some new data types which can increase performance as well (all though that doesn't necessarily always be the case).

Here are some links with information about AS3 performance:

  • Avoid ints in AS3
  • Types in AS3
  • AS3 Performance Tests
  • Flash AS3 and AVM2: Performance Tuning


回答2:

i think you have to be more specific in what exactly are you looking for, i doubt anyone benchmarked and compared everything. also, AS is only the language, but there are speed differences between player versions, platform and browsers too.

but as a general rule, AS3 is almost always faster, sometimes with orders of magnitude.