| 05-13-2006, 09:20 AM | #2 |
Do you really need 0.3 second interval? Also, GetForLoopIntegerA() is a function, is that needed (probably faster to use a variable directly)? |
| 05-13-2006, 09:24 AM | #3 |
| 05-13-2006, 09:25 AM | #4 |
No it wont lag. This is quicker and better tho: which removes the location creation since you dont really use it as a location anyways, this is alot faster, and you could even run it every 0.01 secs (if you dont have any other laghungry triggers). Edit: blu is fast. Edit: and wrong, he forgot udg_ in front of the hero variable :p |
| 05-13-2006, 10:32 AM | #5 |
Hmmz, thanks lads, that puts my mind at rest. Just wondering, because I'd heard that constantly running triggers can cause problems. |
| 05-13-2006, 10:55 AM | #6 |
Thats only if you dont fix up memory leaks. Periodic trigger themselves do not lag. |
| 05-13-2006, 11:00 AM | #7 |
They take up a small (temporary) amount of memory, and a small amount of processing power though, so can add to lag. |
| 05-13-2006, 11:06 AM | #8 |
That can be ignored, only their contents are of concern. If I make 1000 triggers that run periodic each 0.01 second without content it will not lag. |
| 05-13-2006, 04:20 PM | #9 |
Trigger: Check out, access to bj_forLoopAindex then udg_Player_Backpacks and finally evaluating the position of the array besides of the lengthy names, doing stuff twice is something I would never recommend Also GUI's for each integer A ... thing is slow besides you can get rid of the darn trigger and save much more JASS:function BackPack_Update takes nothing returns nothing local unit u local unit a local integer i=1 loop exitwhen i>8 set a=udg_Player_Backpacks[i] set u=udg_Player_Heroes[i] call SetUnitX(a,GetUnitX(u)) call SetUnitY(a,GetUnitY(u)) set i=i+1 endloop set u=null set a=null endfunction function InitTrig_Backpack_Update takes nothing returns nothing call TimerStart(CreateTimer(),0.3,true,function BackPack_Update) endfunction And to answer the question, not even the first trigger is supposed to cause any noticeable lag. 0.3 seconds is kind of a huge delay edit: I have my doubts if accessing the array twice is really slower than using aux variables that then need to be set to null |
| 05-13-2006, 06:00 PM | #10 |
Well, why dont you test it then? :) I think the array way is faster. |
| 05-13-2006, 06:55 PM | #11 |
I don't have the time, and by the use of logic and mostly because of the over sized variable names I am almost sure that it would be slower |
| 05-13-2006, 08:07 PM | #12 |
Hmm I tested it like this: JASS:function test takes nothing returns nothing local integer i = 0 local unit u loop exitwhen i > 100 set u = udg_Player_Hero[1] call SetUnitX(u, GetUnitX(u)) set i = i + 1 endloop set u = null endfunction Then I ran JASS:function test takes nothing returns nothing local integer i = 0 loop exitwhen i > 100 call SetUnitX(udg_Player_Hero[1], GetUnitX(udg_Player_Hero[1])) set i = i + 1 endloop endfunction |
| 05-13-2006, 08:13 PM | #13 |
err, you didn't understand what I said at all. Try with a longer name for i . like local integer ii_iiiiiiiiiiiiii |
| 05-13-2006, 08:22 PM | #14 |
That would be even slower then yes. Wasnt this about testing if the longer names/array made up for the setting of the local and the nulling? |
| 05-13-2006, 08:48 PM | #15 |
the total size including the variable used by the index, in the above case it was bj_forLoopAIndex which is quite long. Also in this case there are 2 different arrays used and the set to null should be inside the loop |
