| 06-26-2007, 06:04 AM | #1 |
JASS:function A takes integer a, integer b returns nothing //do something endfunction function TestTrig takes nothing returns nothing call A(123,321) //... JASS:globals private integer Temp_a private integer Temp_b endglobals function B takes nothing returns nothing local integer a = Temp_a local integer b = Temp_b //do something endfunction function TestTrig takes nothing returns nothing set Temp_a = 123 set Temp_b = 312 call ExecuteFunc("B") //... basically both does almost the same thing, just that the ExecuteFunc doesn't have troubles such as where the function B is placed above or bottom of function Test Trig, my question is : is it encouraged to mass spam ExecuteFunc ? Will it cause any problems or slower perfomance compared to calling a function instead ? thx |
| 06-26-2007, 06:26 AM | #2 |
ExecuteFunc is far slower, as it has to create a new thread. Very much slower in fact. |
| 06-26-2007, 07:11 AM | #3 |
execute far more flexeble in use. you may generate complex set of function calls and call random actions from string array and execute. |
| 06-26-2007, 08:49 AM | #4 |
TriggerEvaluate() is faster but the usage is more problematic =\ to get back and forward "conection" you would need a boolexpr variable (array). but it almost 2x faster than Execute (TriggerExecute is also slow) // PS Vex could include some stuff (vJass) to make it easier for example. Code:
call CusExec("My_Func")to Code:
call TriggerEvaluate(gen_exec_My_Func_trig) |
| 06-26-2007, 02:37 PM | #5 |
call My_Func.execute() |
| 06-26-2007, 03:36 PM | #6 |
O_o when did u add that to vJass... aw... need to go read up the latest vJass manual now... |
| 06-26-2007, 03:51 PM | #7 |
ExecuteFunc is only encouraged when you are in need of running in a new thread. And when is this? Usually when you hit the thread limit (when you know your trigger will run 5000 functions or so). Or possibly when messing with TriggerSleepAction - this function actually pauses the whole thread so take a look at this code: JASS:function bar takes nothing returns nothing call TriggerSleepAction(5) call BJDebugMsg("!") endfunction function foo takes nothing returns nothing call TriggerSleepAction(5) call bar() call BJDebugMsg("!") endfunction Now if you change call bar() into call ExecuteFunc("bar") the whole thing changes... It waits 5 seconds, displays one exclamation mark, waits another 5 seconds and then the second exclamation appears. Simply put, running in a new thread means that the executed function is completely independent. But, as stated above, it's also slower so use only if you have to. Also worth mentioning that if you give ExecuteFunc an invalid name or some function that takes/returns something, the game crashes. |
| 06-26-2007, 04:01 PM | #8 |
I know about that, I'm asking about perfomance and stability of ExecuteFunc here. Anyway I seldom use TriggerSleepAction now days lol. as DioD said, I'm trying to do something like that, so I was wondering will it cause any trouble if I were to mass it... |
| 06-26-2007, 04:18 PM | #9 |
it wont cause fps drop more then 3 |
| 06-26-2007, 04:21 PM | #10 | |
Quote:
|
| 06-26-2007, 05:34 PM | #11 | |
Quote:
i don't know... what is to do... create trigger + add codition (give a function a id) replace all call with triggereavaluate(trigg[function id]) thats all yes intialization of this triggers can me below config =) but to copy the function !? |
