AS3 Vector.sort() VS Array.sort() Benchmark

 

Working on optimization can be fun, repetitive and mostly painful toward the end.
Here is my benchmark for the sort() function. I wanted to compare Array and Vector performances.

 

This randomizing function has been use as sorting function

test.sort(function(){return Math.floor(Math.random()*3)-1});

 

Data type

The datatype used for filling the vector/array : int

 

Loop style

1m = for(n:int=0; n<1000000; ++n)
2.5m = for(n:int=0; n<2500000; ++n)

Lire la suite