概要
実験により、AutoHotkeyにおける等価の判断処理は、以下の順に遅くなることがわかりました。
- IfEqual, b, %c%
- IfEqual, b, 1
- If b=1
- If (b=c)
- If b=%c%
DvorakJでは IfEqual を多用するように書き換えることとします。
実験手段
software / AutoHotkey スレッド part7のレス671とレス787をもとに、実験をしてみました。
b = 1 c = 1 Gui, Add, ListView,Grid,Name|Count|Time(ms) Loop, 3 LV_ModifyCol(A_Index, 80) Gui, Show count := 1000 * 1000 Tests = Test1|Test2|Test3|Test4|Test5 Loop, PARSE, Tests, | { StartTime := A_TickCount Gosub, %A_LoopField% Time := A_TickCount - StartTime LV_Add("", A_LoopField, count, Time) } return Test1: Loop, %count% { IfEqual, b, %c% a = 1000 } Return Test2: Loop, %count% { IfEqual, b, 1 a = 1000 } Return Test3: Loop, %count% { If b=%c% a = 1000 } Return Test4: Loop, %count% { If b=1 a = 1000 } Return Test5: Loop, %count% { If (b=c) a = 1000 } Return