EDIT
My original answer was wrong except for the very last part, and I have to apologize for that. I knew that Vector has exactly four "under the hood" implementations. (You can find decompiled sources from FP 10 playerglobal.swc in Robert Penner's post here ) Three of them are related to number types (int, uint and number). One for object types. This last one serves as a trick and accepts all classes derived from Object. That's why I suggested that Vector.<Object> is still faster than Array, relying on information about vectors and arrays available from Adobe .
However, it seems that this information is incorrect or, at least, it leaves some important parts:
While Vector.<AnyClassDerivedFromObject> allows strong typing, information of this type is evaluated only at compile time (so you get more type safety), but not at runtime - thus, in essence, the benefits of strict sets of object vectors do not apply to performance. See this blog post for more information.
Therefore, the only Vector implementations that are faster than Array are unique to number types (!).
In fact, I did some extensive testing on this and came to the conclusion that although Vector.<int> up to 60% faster than Array from int, all derivatives of Vector.<Object> not only equal in speed (i.e. Vector.<Object> performs the same actions as Vector.<String> , they are also about 20% slower than Array. I checked the double and triple check, so I think the results will be pretty accurate.
It is true that numeric type vectors are faster, so you should use them for performance advantages over an array. But:
End edit
Only if you are going to use sort() , sortOn() or any other of the convenient Array sort functions, you can still decide otherwise, because these are native functions and, as such, are very fast. Implementing Vector's own sorting methods will probably not match their speed.
source share