HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Efficiency - ExecFunc VS TriggerExec

08-31-2006, 01:13 PM#1
Chuckle_Brother
Okeydoke, lemme give some quick background info.

I use a wee little storing method for a generic damage detection system that I use, that until now has been calling functions given it by way of ExecuteFunc. This of course means that any conditionals for the event in question must be done within the actual function of the spell....which is pretty dumb I know.

So what I wanna know is whether or not its more advantageous to use TriggerExecute, and pass a trigger to the system to conditionally execute it in that manner as the system moves through its steps.

Insight definately needed.
08-31-2006, 04:10 PM#2
PipeDream
I put my money on TriggerEvaluate being fastest. Will do some meaningless benchmarks in a couple hours, stay tuned.

If you actually want to use conditions though and TriggerExecute/Evaluate combo implement the exact functionality you need, seems like you should just go with that.
08-31-2006, 04:54 PM#3
Vexorian
If there are 2 ways to do something, and one involves creating a trigger and the other one doesn't, go for the other one, not for the speed but for the least complications and to avoid random bugs.
08-31-2006, 06:53 PM#4
PipeDream
Alright here are my measurements. Remember this is a really stupid benchmark, don't take it seriously.
Code:
50,000 calls (10,000 x 5 calls inside loop)  units are ms
No return
empty loop through 10,000 6 7 6
TriggerExecute 533 540 537
ExecuteFunc 968 964 964
call 19 19 19
(w/return true)
TriggerEvaluate 264 266 266
Based on the time relative to an empty call it appears the vast majority of any short chunk of code will be swamped out by the overhead to executefunc/trigeval/trigexec. So you want to use a single call to whichever you use, and of them, TriggerEvaluate is fastest, presumably because it doesn't create a new thread.
08-31-2006, 07:18 PM#5
Chuckle_Brother
Exectrig stays in with the same thread possibly? If so then I agree with Vex, I don't wanna hit shit like exec limit...which would suck for spells that I use threading to imitate some sort of looped behaviour.

Many thanks.
08-31-2006, 07:42 PM#6
PipeDream
No, TriggerExecute and ExecuteFunc behave identically. With TriggerExecute you won't have hunting down crash hell. ExecuteFunc is suitable for one off tests but if you want something reliable/maintainable you have to put in the extra effort that TriggerExecute or Evaluate takes.

Hopefully even the modicum of extra effort it takes will be eliminated soon, though.
08-31-2006, 08:46 PM#7
Chuckle_Brother
Ah, misunderstood this TriggerEvaluate is fastest, presumably because it doesn't create a new thread.

And its not that much work, just gotta restructure a few things.

At any rate I will just see for myself by plopping it in and seeing what happens.