int++ uint++ int-- uint-- 比較
♥0 |
Line 42 |
Modified 2011-10-15 09:32:57 |
MIT License
archived:2017-03-20 08:07:07
ActionScript3 source code
/**
* Copyright yasurageruheya ( http://wonderfl.net/user/yasurageruheya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/sNw5
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.utils.getTimer;
public class FlashTest extends Sprite {
private const txt:TextField = new TextField();
private const COUNT:uint = 10000000;
public function FlashTest() {
// write as3 code here..
txt.autoSize = "left";
addChild(txt);
stage.addEventListener(MouseEvent.CLICK, test);
test(null);
}
private function test(e:MouseEvent):void
{
stage.removeEventListener(MouseEvent.CLICK, test);
txt.text = "";
var pInt:int;
var pUint:uint;
var len:uint = COUNT;
var timer:int = getTimer();
pInt = len;
while (pInt--) { }
txt.appendText("int-- : " + (getTimer() - timer) + "ms\n");
timer = getTimer();
pUint = len;
while (pUint--) { }
txt.appendText("uint-- : " + (getTimer() - timer) + "ms\n");
timer = getTimer();
pInt = 0;
while (pInt++ < len) { }
txt.appendText("int++ : " + (getTimer() - timer) + "ms\n");
timer = getTimer();
pUint = 0;
while (pUint++ < len) { }
txt.appendText("uint++ : " + (getTimer() - timer) + "ms\n");
txt.appendText("クリックで再計算");
stage.addEventListener(MouseEvent.CLICK, test);
}
}
}