ActionScript 3 Array constructor vs Array literals benchmark
Posted on 16th November 2009 in ActionScript | No Comments »
By the latest Coding Convention of ActionScript 3, the usage of the Array constructor is only encouraged for size allocation, e.g. var myArr:Array = new Array(2); for an array with 2 elements in it. In all other cases literals should be used, e.g. var myArr:Array = [];
Performance-wise this makes a lot of sense with up to 3 times of the speed difference:

The above chart displays 3 different tests through 1 000 000 iterations all confirming that Array literals are a lot faster in the circumstances.
So for creating an Array, use
var myArr:Array = []; |
instead of
var myArr:Array = new Array(); |

