New Performance of ActionScript Vector in Flash Player 10

As you know the Flash Play 10 will be released in this month. There are many new features and improvement in it for example the 3D, text engines, pixel bender and etc.. Then someone maybe interested in the Vectors. Mr. Michael has written the difference on the vectors by comparing the code between the old and new version. If you are also excited about vector like him, you won’t miss the following text.

The old version code:

private function testArray():Number{
var startTime:Date = new Date();
var arrStr:String = null;
var arr:Array = new Array();
var i:int=0;
for (i=0;i<=94;i++){ arr.push(i); } for (i=0;i<=arr.length;i++){ arr.push(arr.pop()); arr.sort().reverse(); arr.push(arr.splice(0,1)); } arrStr = arr.join(); return (new Date()).getTime() - startTime.getTime(); }

The new version code:

private function testVector():Number{
var startTime:Date = new Date();
var v:Vector. = new Vector.();
var arrStr:String = null;
var i:int = 0;
for (i=0;i<=94;i++){ v.push(i); } for (i=0;i<=v.length;i++){ v.push(v.pop()); v.sort(comp).reverse(); v.push(v.splice(0,1)); } arrStr = v.join(); return (new Date()).getTime() - startTime.getTime(); }

More detail please read here:

1 thought on “New Performance of ActionScript Vector in Flash Player 10”

Leave a Reply

Your email address will not be published. Required fields are marked *