In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

for, *, /, >>

/**
 * Copyright keno42 ( http://wonderfl.net/user/keno42 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bjRe
 */

package {
    import flash.display.Sprite;
    import flash.text.*;
    import flash.utils.*;
    public class FlashTest extends Sprite {
        private static const COUNT:int = 5000000;
        private var array:Array = [];
        private var tf:TextField = new TextField();
        public function FlashTest() {
            // write as3 code here..
            addChild(tf);
            tf.autoSize = "left";
            testLoop();
            testLoop();
            testLoop();
            testShift();
            testShift();
            testShift();
            testMultiply();
            testMultiply();
            testMultiply();
            testDivide();
            testDivide();
            testDivide();
        }
        private function testLoop():void
        {
            var time:uint = getTimer();
            var i:int, j:Number;
            for( i=0; i < COUNT; i++ ){
                1;
            }
            tf.appendText("ループ: " + String(getTimer()-time) + "\n");
        }
        private function testMultiply():void
        {
            var time:uint = getTimer();
            var i:int, j:Number = 1 / 1024;
            for( i=0; i < COUNT; i++ ){
                var k:Number = 5000 * j;
            }
            tf.appendText("掛け算: " + String(getTimer()-time) + "\n");
        }
        private function testDivide():void
        {
            var time:uint = getTimer();
            var i:int, j:Number = 1024;
            for( i=0; i < COUNT; i++ ){
                var k:Number = 5000 / j;
            }
            tf.appendText("割り算: " + String(getTimer()-time) + "\n");
        }
        private function testShift():void
        {
            var time:uint = getTimer();
            var i:int, j:Number;
            for( i=0; i < COUNT; i++ ){
                var k:Number = 5000 >> 10;
            }
            tf.appendText("シフト: " + String(getTimer()-time) + "\n");
        }
    }
}