- Joined
- Jan 9, 2005
- Messages
- 2,124
Is it better to have one timer that runs multiple triggers (with booleans for deciding if they run or not) or having multiple timers on/off when I need them? All my timers run at 0.03 seconds interval.
Man, those poor baby seals.The difference is negligible. If you already have it implemented, then keep it the way it is.
Running things on one timer is pretty nice and convenient. However, if you have too many systems that depend on it, you can easily develop bottlenecks within your code.
Picture it this way: you own a factory with slaves as employees. You tell one slave to go club a baby seal. Unfortunately, 10 more baby seals arrive. As such, you send off 10 more slaves to go club them.
Now consider the single-slave case. It is pretty convenient to have one slave club a couple of baby seals for you. But as more and more baby seals are added, he'll have a lot more work to do--and hell, there is only so much clubbing that one man can do. That is where the bottleneck arises.
There are advantages and disadvantages to both methods. With the "many slaves" solution, there are a lot more slaves to deal with/monitor (in wc3 terms, the computer would have more threads to schedule). But since things are on their own timers, they aren't expected to all run at the same instant. There may be two timers that run every 1 second, but one might've started at 0.5 seconds into the game and the other at 0.7. As such, there would be no bottleneck--they end up "completing" at different time periods. With one timer, wc3 may have an easier time scheduling threads, but you run the risk of developing a bottleneck. Ultimately, ask yourself: how well would this run if every single timer was active in this trigger?