We have an application containing a lot of user controls that update frequently based on a System.Windows.Forms.Timer. Am I safe to add a Timer instance to each control peformancewise? Or should I have one Singleton Timer that runs all the time that is to be used by all instances? What is acutally happening under the hood? Will there be a an additional thread (for counting) for each timer?
We have an application containing a lot of user controls that update frequently based
Share
There is no additional thread. There are just a lot of WM_TIMER messages coming in your thread’s message queue. So these timers won’t execute their code in parallel, even if their timespans overlap.
I think that it wouldn’t hurt to have a separate timer for evey control. At least it definately won’t have any measureable performance difference over using a single timer. The code will get more readable though. 😉
Btw – with todays massive move to multiple CPU cores, consider if this perhaps isn’t a place where you can benefit from it.