HSP | 配列変数が「遅い」
HSP | 配列変数が「遅い」
読み込み
#include "kernel32.as"
// 配列 (一括)
GetTickCount
s = statrepeat 1000000
c = 0xFF, 0xFF, 0xFF
loopGetTickCount
e = statmes "" + (e - s) + " ms"
// 配列 (別々)
GetTickCount
s = statrepeat 1000000
c.0 = 0xFF
c.1 = 0xFF
c.2 = 0xFF
loopGetTickCount
e = statmes "" + (e - s) + " ms"
// 配列を使わない
GetTickCount
s = statrepeat 1000000
r = 0xFF
g = 0xFF
b = 0xFF
loopGetTickCount
e = statmes "" + (e - s) + " ms"
(※簡単のため、変数名やループが手抜きですが許してください (^^;
(いつもはちゃんと変数名付けてますよっ!!
78 ms
234 ms
135 ms
書き込み
#include "kernel32.as"
// 配列
GetTickCount
s = statrepeat 1000000
c = 0xFF, 0xFF, 0xFF
x = c.0
x = c.1
x = c.2
loopGetTickCount
e = statmes "" + (e - s) + " ms"
// 配列を使わない
GetTickCount
s = statrepeat 1000000
r = 0xFF
g = 0xFF
b = 0xFF
x = r
x = g
x = b
loopGetTickCount
e = statmes "" + (e - s) + " ms"
344 ms
297 ms