Antares
Spell Reviewer
- Joined
- Dec 13, 2009
- Messages
- 982
Hi everyone,
some parts of my script are run several thousand times per second, so every bit of optimization is useful. I have three questions:
1.
vs.
With z being constant, which one is faster? I vaguely remember that for units, the second method is faster, but iirc it was because it doesn't check collisions. So I would think that the first method is faster.
2.
vs.
I wasn't aware that TriggerRemoveCondition existed, so I didn't think about using it. But I would guess that it's much faster since it avoids creating a handle each time.
3. Something I've always wondered is how expensive are array lookups and when does it become viable to store the array variable in a new non-array variable. For example, which one is faster?
vs.
Thanks for any help!
some parts of my script are run several thousand times per second, so every bit of optimization is useful. I have three questions:
1.
JASS:
call BlzSetSpecialEffectPosition( T_A.visual , T_A.x , T_A.y , T_A.z )
JASS:
call BlzSetSpecialEffectX( T_A.visual , T_A.x )
call BlzSetSpecialEffectY( T_A.visual , T_A.y )
2.
JASS:
set whichTrigger = CreateTrigger()
call TriggerAddCondition( whichTrigger , PARTICLE_CONTACT_FUNC[T_A.particleType][T_B.particleType] )
call TriggerEvaluate(whichTrigger)
call DestroyTrigger(whichTrigger)
JASS:
call TriggerAddCondition( whichTrigger , PARTICLE_CONTACT_FUNC[T_A.particleType][T_B.particleType] )
call TriggerEvaluate(whichTrigger)
call TriggerRemoveCondition(whichTrigger , PARTICLE_CONTACT_FUNC[T_A.particleType][T_B.particleType]) // or TriggerClearConditions(whichTrigger)
3. Something I've always wondered is how expensive are array lookups and when does it become viable to store the array variable in a new non-array variable. For example, which one is faster?
JASS:
set B = A[I] + 1
set C = 2*A[I]
set D = SquareRoot(A[I])
JASS:
set Ai = A[I]
set B = Ai + 1
set C = 2*Ai
set D = SquareRoot(Ai)
Thanks for any help!