// 変数アクセス時間計測 (2003/02/26) ##n = 1000; // 全定義数 n ##2 = 500; // インデックス i $$1 = "var" + str(##2); ##Loop = 1000; ##Repeat = 1; // 配列のとき ##i = 1; while (##i <= ##n) { $var[##i] = "a 16bytes string"; ##i = ##i + 1; } // 田楽のとき // loaddll hidemarudir + "\\DengakuDLL.dll"; // ##i = 1; // while (##i <= ##n) { // ##result = dllfunc("SETVAR", "var" + str(##i), "a 16bytes string"); // ##i = ##i + 1; // } goto Main; // 実行時間(ミリ秒/回) Case1: ##starttime=tickcount; while(#loopcount){ // 配列 $var[##2] = "a 16bytes string"; // 田楽 // ##r = dllfunc("SETVAR", $$1, "a 16bytes string"); #loopcount=#loopcount-1;} return tickcount-##starttime; Case2: ##starttime=tickcount; while(#loopcount){ // 配列 $$r = $var[##2]; // 田楽 // $$r = dllfuncstr("GETVAR", $$1); #loopcount=#loopcount-1;} return tickcount-##starttime; Case0: ##starttime=tickcount; while(#loopcount){ #loopcount=#loopcount-1;} return tickcount-##starttime; endmacro; Main: if (updated) { question "保存しますか?"; if (result) { save; endmacro; } } disabledraw; while (##r < ##Repeat) { #loopcount = ##Loop; title "計測中 (" + str(##r + 1) + "/" + str(##Repeat) + ")"; call Case0 $$1, ##2; ##t0 = ##t0 + ##return; #loopcount = ##Loop; title "計測中 (" + str(##r + 1) + "/" + str(##Repeat) + ") Case1"; call Case1 $$1, ##2; ##t1 = ##t1 + ##return; #loopcount = ##Loop; title "計測中 (" + str(##r + 1) + "/" + str(##Repeat) + ") Case2"; call Case2 $$1, ##2; ##t2 = ##t2 + ##return; ##r = ##r + 1; } // 正規化 call Million (##t1 - ##t0) * (1000000 / ##Loop) / ##Repeat; $$t1 = $$return; call Million (##t2 - ##t0) * (1000000 / ##Loop) / ##Repeat; $$t2 = $$return; // 結果書き出し gofiletop; searchdown "^// 実行時間", regular; if (result) down; insertfix "// " + month + "/" + day + " " + time + "\t" + str(##n) + "\t" + str(##2) + "\t" + $$t1 + "\t" + $$t2 + "\n"; endmacro; Million: // 下3桁を落とし、3桁目に小数点を付ける $$v = str(##1); while (strlen($$v) < 7) $$v = "0" + $$v; $$v = leftstr($$v, strlen($$v) - 6) + "." + leftstr(rightstr($$v, 6), 3); return $$v;