Performance System.Windows.Forms.Timer

We have an application that contains many user controls that are often updated based on System.Windows.Forms.Timer. Can I add a Timer instance to each control? Or should I have one Singleton timer that runs all the time, which should be used by all instances? What happens under the hood? Will there be an extra thread (for counting) for each timer?

+1
source share
3 answers

No extra thread. There are only a lot of WM_TIMER messages in your thread message queue. Thus, these timers will not execute their code in parallel, even if their time intervals overlap.

I think it would not hurt to have a separate timer for managing evey. At the very least, it will definitely not have any measurable performance difference using a single timer. However, the code will be more readable.;)

Btw - with today's massive transition to multiple processor cores, think about whether this could be where you can benefit from it.

+1
source

System.Windows.Forms.Timer ol User32 Timers. , . , , .

, , , ""? 10? 10000?

, , ? ? 100 ? , ?

- . , , , , . , , WM_TIMER , .

+2

? ?

, , , , ...

+1

Source: https://habr.com/ru/post/1715402/


All Articles