- Joined
- Mar 16, 2008
- Messages
- 941
Well, I've some question regarding the efficiency.
I've some problems with spelltriggers.
1) People keep saying that conditions are faster then actions, ok.
2) If I use conditions, all locals for the spell are allocated on each cast, since I can't "write" them after the if condition if it's the right spell.
Each cast would first allocate them before checking... that's a waste of performance, isn't it?
3) Is it faster with a dummyfunction?
4) Is a single trigger with ALL spells better (huge if-condition and keep in mind that you could deactivate unnecessary triggers)
5) If 4) is true, how fast would a hashtable with the spell-ids be instead of a huge if-condition? (Code-Array with the IDs in a table)
Greets, Justify
I've some problems with spelltriggers.
1) People keep saying that conditions are faster then actions, ok.
2) If I use conditions, all locals for the spell are allocated on each cast, since I can't "write" them after the if condition if it's the right spell.
JASS:
function MyCondition takes nothing returns boolean
local unit u
local player p
local real x
local real y
if GetSpellAbilityId() == SPELL_ID then....
3) Is it faster with a dummyfunction?
JASS:
function MyConditionEx takes nothing returns nothing
local unit u
local player p
local real x
local real y...
endfunction
function MyCondition takes nothing returns boolean
if GetSpellAbilityId() == SPELL_ID then
call MyConditionEx()...
JASS:
function MyCondition takes nothing returns boolean
local integer ABIL_ID = GetSpellAbilityId()
if ABILD_ID = 'ASDF' then
call FunctionASDF()
elseif ABILD_ID = 'SDFG' then
call FunctionSDFG()...
Greets, Justify