JavaScript版
private var nArrayNum : int = 5000;
private var numArray : int[];
private var arr0 : Array;
private var fBaseTime : float = 0.0f;
private var fCurTime : float = 0.0f;
function Start() {
TestArray();
}
function Update() {
if(Input.GetKeyDown(KeyCode.Keypad4)) {
TestArray();
}
}
// 配列のテスト
function TestArray() {
var i : int = 0;
numArray = new int[ nArrayNum ];
arr0 = new Array();
// Test1
fBaseTime = Time.realtimeSinceStartup;
for(i = 0; i < nArrayNum; i++) {
numArray[i] = i;
}
fCurTime = Time.realtimeSinceStartup;
Debug.Log("Test1 time = " + ((fCurTime - fBaseTime) * 1000.0f).ToString() + "(ms)");
// Test2
fBaseTime = Time.realtimeSinceStartup;
for(i = 0; i < nArrayNum; i++) {
arr0.Push( i );
}
fCurTime = Time.realtimeSinceStartup;
Debug.Log("Test2 time = " + ((fCurTime - fBaseTime) * 1000.0f).ToString() + "(ms)");
}
0 件のコメント:
コメントを投稿