HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

timer vs periodic

02-24-2008, 12:57 PM#1
MaD[Lion]
anyone know which is faster, timer or periodic event. As in performance.
02-24-2008, 01:08 PM#2
Vexorian
timer, almost a duh.
02-24-2008, 01:10 PM#3
Troll-Brain
Quote:
Originally Posted by common.j
// Creates it's own timer and triggers when it expires
native TriggerRegisterTimerEvent takes trigger whichTrigger, real timeout, boolean periodic returns event

So i think a timer will be faster, use japi for be sure
02-24-2008, 01:23 PM#4
moyack
I thik is the same thing, with the difference that you have more control with timers.
02-24-2008, 01:30 PM#5
MaD[Lion]
so vexy, wat makes timer faster. and how much faster. let me know pls.. :P

hmm so periodic event creates a trigger hmm... damn it :P
02-24-2008, 01:34 PM#6
Vexorian
Periodic event needs to create a whole trigger thread.
02-24-2008, 02:19 PM#7
moyack
Quote:
Originally Posted by Vexorian
Periodic event needs to create a whole trigger thread.
And therefore they create an event that you can't remove when needed.

Other problem is that you can't change to that handle the frequency and the looping function (actually yes, by destroying it and creating a new trigger, which will create a new event, which means more memory used). In the other hand, a timer can be paused, changed the period, the looping function, etc.

So in conclusion, in terms of memory usage is less efficient a periodic trigger than a timer, in terms of performance.... would you notice the difference??
02-24-2008, 03:10 PM#8
MaD[Lion]
alright... i haveing performance issues :P it seems like tat creating new stuffs really lag... like creating new unit.
Does periodic event's creation also lag like create new unit? I wanna know if its worth while changing all my systems into timer, instead of periodic
02-24-2008, 03:18 PM#9
Captain Griffen
If you have stuff running off one periodic, no problem.

If you are dynamically creating periodics...oh dear, not good, don't do it.