• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

What's the difference between CTL, T32 and TimerUtils?

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
I'm not sure of what I'll say.
These are three libraries about timers.
They have each they functions/methods. They can normally be used in JASS for everything since if you call a method in JASS it's like a function.

I prefer TimerUtils :3

I prefer TimerUtils too. But I saw some posts saying that CTL or T32 can be useful in some situations when something related to "0.03125". I think that number is an interval of something.... but I do not get the whole idea. :(
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Use TimerUtils for non periodic stuff, for example a spell that has 10 second duration. Use the other 2 for periodic events. 0.03125 is the period in periodic events.

period = frequency of execution per time elapsed.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
The difference is performance gain, when you need multiple knockback instances, a single timer will suffice and is a lot faster than having a shitload of timers counting down per instance.
EDIT: Okay, I gave the wrong answer again haha XD.

EDIT: To answer the question of difference:

TimerUtils are optimal for applications involving non-periodic timeout, while the remaining 2 are optimized to handle multiple objects using a single periodic timeout.
 
Level 11
Joined
Oct 11, 2012
Messages
711
Use TimerUtils for non periodic stuff, for example a spell that has 10 second duration. Use the other 2 for periodic events. 0.03125 is the period in periodic events.

period = frequency of execution per time elapsed.

Thanks, chobibo.

1. do you mean TimerUtils should not be used in periodic timer? I use it all the time and seems functioning well. Or do you mean TimerUtils is less accurate than the other twos?

2. do the other two, CTL or T32 require vJass? or can I use it in Jass just like Malhorne said?

3. With regard to CTL and T32, which one is better? Are they substitutable for each other?

Edit: damn, you are right, Malhorne. integer versus real ! XD
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
1. You can use it, but that would use a lot of memory, thus degrading performance.
2. I think so.
3. I honestly don't know, but I suggest using CTL, because it's already approved in the Hive.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
T32 and CTL are quite similar, TimerUtils however is something completely different.

Il start with TimerUtils:
TimerUtils is what you want to use if you need to use single timers to delay or time stuff.
Timerutils basically covers these two things:
1. Recycling Timers: this is a performance feature, it simply means you dont always create a new timer handle but check if there is an old unused one.
2. Data Attaching: TimerUtils allows you to attach an integer value (or a struct instance) to a timer. This is nothing too fancy and can simply be done with a hashtable, but using TimerUtils its much more comfortable because all you have to do is to call a single function.

T32 / CTL:
Imagine you have a struct that does something periodic. Instead of starting a new timer for each instance of that struct you can use a single timer that always runs and make it loop through all the instances of your struct.
The benefits are: 1. You only need one single timer handle, but mostly 2. You dont have to attach stuff to the timer, which is a great performance gain since you dont need a hashtable this way.
This is exactly what these two libraries do for you, they handle the timer and the list that keeps track of all the instances of your struct. All you have to do is define one function with the code that shall run periodically.
Usually these libraries are used for Periodic Spells, Knockbacks, Missiles,


1. do you mean TimerUtils should not be used in periodic timer? I use it all the time and seems functioning well. Or do you mean TimerUtils is less accurate than the other twos?
2. do the other two, CTL or T32 require vJass? or can I use it in Jass just like Malhorne said?
3. With regard to CTL and T32, which one is better? Are they substitutable for each other?
1. No, TimerUtils works just fine with periodic timers. But if you have several instances of the same struct that all do something periodic then T32/CTL will be more comfortable to use and lead to a slightly better performance.
2. Yes, they are vJass.
3. T32 and CTL are two very sophisticated libraries and both work really well. Just use the one your resources require ... (Libraries from TheHelper.net usually require T32 while most resources from Hive use CTL).

1. You can use it, but that would use a lot of memory, thus degrading performance.
I disagree, TimerUtils is designed for excessive use of timers and will still perform perfectly well in any scenario where T32 and CTL are usually prefered.
 
Level 11
Joined
Oct 11, 2012
Messages
711
T32 and CTL are quite similar, TimerUtils however is something completely different.

Il start with TimerUtils:
TimerUtils is what you want to use if you need to use single timers to delay or time stuff.
Timerutils basically covers these two things:
1. Recycling Timers: this is a performance feature, it simply means you dont always create a new timer handle but check if there is an old unused one.
2. Data Attaching: TimerUtils allows you to attach an integer value (or a struct instance) to a timer. This is nothing too fancy and can simply be done with a hashtable, but using TimerUtils its much more comfortable because all you have to do is to call a single function.

T32 / CTL:
Imagine you have a struct that does something periodic. Instead of starting a new timer for each instance of that struct you can use a single timer that always runs and make it loop through all the instances of your struct.
The benefits are: 1. You only need one single timer handle, but mostly 2. You dont have to attach stuff to the timer, which is a great performance gain since you dont need a hashtable this way.
This is exactly what these two libraries do for you, they handle the timer and the list that keeps track of all the instances of your struct. All you have to do is define one function with the code that shall run periodically.
Usually these libraries are used for Periodic Spells, Knockbacks, Missiles,



1. No, TimerUtils works just fine with periodic timers. But if you have several instances of the same struct that all do something periodic then T32/CTL will be more comfortable to use and lead to a slightly better performance.
2. Yes, they are vJass.
3. T32 and CTL are two very sophisticated libraries and both work really well. Just use the one your resources require ... (Libraries from TheHelper.net usually require T32 while most resources from Hive use CTL).


I disagree, TimerUtils is designed for excessive use of timers and will still perform perfectly well in any scenario where T32 and CTL are usually prefered.

Thanks for the detailed answer. +Rep

Edit: cannot +Rep at the moment because of the forum system, will do it when I can.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
There is also Timer Tools, which does the same thing as TimerUtils, except that Timer Tools is faster than native timers, meaning that it's also faster than TimerUtils =). However, Timer Tools is very, very, very complicated, and as such, currently has a bug that nobody can figure out how to fix ;o. This bug could be a bug in wc3 itself with the constant use of timers (timers have been known to bug up before), or it could be with the library itself. I'm inclined to think that it's wc3 ;o, because standard timers were also breaking (regular native ones) just by having Timer Tools in the map.

Speedwise

Timer Tools Faster Than TimerUtils
CTL Faster Than T32
 
Last edited:
Level 11
Joined
Oct 11, 2012
Messages
711
There is also Timer Tools, which does the same thing as TimerUtils, except that Timer Tools is faster than native timers, meaning that it's also faster than TimerUtils =). However, Timer Tools is very, very, very complicated, and as such, currently has a bug that nobody can figure out how to fix ;o. This bug could be a bug in wc3 itself with the constant use of timers (timers have been known to bug up before), or it could be with the library itself. I'm inclined to think that it's wc3 ;o, because standard timers were also breaking (regular native ones) just by having Timer Tools in the map.

Speedwise

Timer Tools Faster Than TimerUtils
CTL Faster Than T32

I do not think I am capable of using Timer Tools at this moment because even you think it is very, very and very complicated. XD

Nes, I strongly think you should open a vJass class, some people like me do need it. :)
 
Status
Not open for further replies.
Top