AS3 Vector VS Array Benchmark (Read Access : int, String, Bitmap)

 

I have seen some benchmarks about Vector VS Array read access, but I wanted to test it myself. I have tested these data type : int, String and Bitmap.

 

Data type

The datatype used for filling the vector/array : int, String and Bitmap.

 

Loop style

20m = for(n:int=0; n<20000000; ++n) 100m = for(n:int=0; n<100000000; ++n) (double loop)

 

Benchmark info

Each test was repeated twice
f = fixed vector
array/vector.length = 10
Both Debug Flash Player 11.1.102.55 and Flash Player 11.1.102.55 where used
Windows Quad-Core CPU

 

Conclusion

Accessing data behaved like expected : Vector is Faster than Array.
BUT, like some people have reported, fixing Vector length doesn't improve speed. Mostly even if not loosing...

 

 

Results in ms (1st result, 2nd result) (debug results in grey) (best result is blue)

IntArray20m = (1482,1477) - (2597,2588)
IntVector20m = (1048,1039) - (2069,1843)
IntVectorf-20m = (1140,1047) - (1772,1767)

IntArray100m = (7384,7402) - (12902,12813)
IntVector100m = (5217,5230) - (9174,8965)
IntVectorf-100m = (5235,5238) - (8842,8856)

 

StringArray20m = (1616,1618) - (2484,2466)
StringVector20m = (1305,1222) - (1992,1999)
StringVectorf-20m = (1223,1222) - (2252,2008)

StringArray100m = (8075,8080) - (12411,12380)
StringVector100m = (6348,6526) - (10007,9984)
StringVectorf-100m = (6275,6595) - (9931,9987)

 

BitmapArray20m = (2513,2488) - (3353,3354)
BitmapVector20m = (1988,1991) - (2972,3068)
BitmapVectorf-20m = (1994,1983) - (3072,3138)

BitmapArray100m = (12363,12653) - (BUSTED)
BitmapVector100m = (9842,9854) - (15430,14858)
BitmapVectorf-100m = (9861,9964) - (15487,15568)