What gives the best performance? (edited to include another option)
var myVec:Vector.<Number> = new Vector.<Number>();
for (...)
// Do stuff - example: myVec.push(Math.random());
// Need to empty and repopulate vector
myVec.splice(0, myVec.length);
// OR
myVec = new Vector.<Number>();
// OR
myVec.length = 0;
Using the code below I’ve found
myVec = new Vector.<T>()is the fastest way.Output (average times in ms to empty a
Vector.<Number>with 100000 random entries):Code: