- Joined
- Sep 26, 2009
- Messages
- 9,521
ForForce and TriggerEvaluate run at about the same speed, which is about 4x faster than TriggerExecute, which is about 50-100% faster than ExecuteFunc. So ExecuteFunc is about 8x slower than TriggerEvaluate, making TriggerEvaluate by far the best option for running dynamic code.
ExecuteFunc's main benefit being that it doesn't use any handles, means it's fine to use it for occasional code threading but not nearly as useful for dynamic purposes.
This can be used as a reference for anyone who's running a test.
ExecuteFunc's main benefit being that it doesn't use any handles, means it's fine to use it for occasional code threading but not nearly as useful for dynamic purposes.
This can be used as a reference for anyone who's running a test.
JASS:
scope Poop initializer Init
globals
private trigger trig = CreateTrigger()
private force f = CreateForce()
endglobals
function TestFunc takes nothing returns nothing
endfunction
private function Tester takes nothing returns nothing
local integer i = 500
loop
set i = i - 1
//call ExecuteFunc("TestFunc")
//call TriggerExecute(trig)
//call TriggerEvaluate(trig)
call ForForce(f, function TestFunc)
exitwhen i == 0
endloop
endfunction
private function Init takes nothing returns nothing
local code c = function TestFunc
//call TriggerAddAction(trig, c)
//call TriggerAddCondition(trig, Filter(c))
call ForceAddPlayer(f, Player(0))
call TimerStart(CreateTimer(), 0.03125, true, function Tester)
endfunction
endscope