呼叫2个SetTimers或1个SetTimer频率更高 [英] Call 2 SetTimers or 1 SetTimer called more often

查看:62
本文介绍了呼叫2个SetTimers或1个SetTimer频率更高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想知道在3项资源中哪一项资源最少?

计时m = 200,n = 100
1)2个CWnd :: SetTimer,具有2个不同的ID和2个不同的计时

时序m = 200,n = 100,其中最大公约数是其中之一.
2)1个具有1个ID和1个等于100的计时的CWnd :: SetTimer,并且CWnd :: OnTimer方法具有一个计数器,该计数器将调用相关方法.

时序m = 300,n = 200,其中最大公约数不是其中之一.
3)1个具有1个ID和1个等于100的计时的CWnd :: SetTimer,并且CWnd :: OnTimer方法具有一个将调用相关方法的计数器.

如果您可以对它们进行排名,那就更好了.谢谢!

Hi,

I was wondering which would be the least resource intensive among the 3:

Timing m = 200, n = 100
1) 2 CWnd::SetTimer with 2 different IDs and 2 different timings

Timing m = 200, n = 100, where the greatest common divisor is one of them.
2) 1 CWnd::SetTimer with 1 ID and 1 timing where it is equal to 100 and the CWnd::OnTimer method has a counter which will call the relevant methods.

Timing m = 300, n = 200, where the greatest common divisor is not one of them.
3) 1 CWnd::SetTimer with 1 ID and 1 timing where it is equal to 100 and the CWnd::OnTimer method has a counter which will call the relevant methods.

If you can rank them, it would be even better. Thanks!

推荐答案

计时器是一种稀缺资源:请始终使用可以避免的绝对最小值!因此,选择2或3-但从您的描述来看,它们之间没有太大区别.
Timers are a scarce resource: always use the absolute minimum you can get away with! So, go for 2 or 3 - but I don''t see much difference between them from your description.


这篇关于呼叫2个SetTimers或1个SetTimer频率更高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆