import flash.utils.getTimer; var time:Number = getTimer(); function runDivisionTest():void{ time = getTimer(); for (var i:Number=0; i<10000000; i++) { var test:Number = i/2; } trace("DivisionTest: ", (getTimer()-time)); } function runMultTest():void{ time = getTimer(); for (var i:Number=0; i<10000000; i++) { var test:Number = i*.5; } trace("MultTest: ", (getTimer()-time)); } function runBitTest():void{ time = getTimer(); for (var i:int=0; i<10000000; i++) { var test:int= i>>1; } trace("BitTest: ", (getTimer()-time)); } function runFloorTest():void{ time = getTimer(); for (var i:uint=0; i<10000000; i++) { var n:Number =1.5; var test:Number = Math.floor(n); } trace("FloorTest: ", (getTimer()-time)); } function runUintTest():void{ time = getTimer(); for (var i:uint=0; i<10000000; i++) { var n:Number =1.5; var test:uint = uint(n); } trace("UintTest: ", (getTimer()-time)); } function runCeilTest():void{ time = getTimer(); for (var i:uint=0; i<10000000; i++) { var n:Number =1.5; var test:Number = Math.ceil(n); } trace("CeilTest: ", (getTimer()-time)); } function runUintCeilTest():void{ time = getTimer(); for (var i:uint=0; i<10000000; i++) { var n:Number =1.5; var test:uint = n == uint(n) ? n : uint(n)+1; } trace("UintCeilTest: ", (getTimer()-time)); } function runABSTest():void{ time = getTimer(); for (var i:uint=0; i<10000000; i++) { var n:Number =-1.5; var test:Number = Math.abs(n); } trace("ABSTest: ", (getTimer()-time)); } function runABSMultTest():void{ time = getTimer(); for (var i:uint=0; i<10000000; i++) { var n:Number =-1.5; var test:Number = n <0? n *-1 : n; } trace("ABSMultTest: ", (getTimer()-time)); } runDivisionTest(); runMultTest(); runBitTest(); runFloorTest(); runUintTest(); runCeilTest(); runUintCeilTest(); runABSTest(); runABSMultTest();