Archive for the ‘AS3 Tips’ Category

AS3 Optimization – Fastest Way to Copy an Array

Came across an interesting article about AS3 optimization and what was the fastest way to copy an array. Benoit Beausejour at agit8 did a series of test using various methods of copying an array. The results are based on copying 500000 elements and are listed below:

for() unoptimized: 118ms

for() key-key optimized: 30ms

while() key-key optimized: 30ms

Bytearray copy: 176ms

Array slice(): 19ms

Array concat(): 8ms

More information about this and the source code that he used to find this out can be found here.