User forums > Help

CPU 100% when moving mouse in CB (toolbar/editor/manager/etc)

<< < (3/3)

Biplab:
Thanks for the update. :D

There are couple of interesting functions in wxUpdateUIEvent class. Function CanUpdate() can be helpful in reducing the load further. It checks whether to send Update event to a window or not.

I don't have in-depth knowledge of event system. But, IMHO, this can be helpful in some ways. :)

Regards,

Biplab

bughunter2:
Hey guys, this worked for me, just about 2 - 3 % CPU usage now, astonishing!

However, I was thinking of something. Because the UI is updated once in 100ms, the CPU usage of course becomes less, because it's just busy for once in 100ms.

But won't the queue get full of update messages? I mean when the UpdateUI handler sends new UpdateUI messages because of updating, it would mean we can get some lag since the messages are only processed once in 100ms?

What I mean with the lag is, something of 100ms ago is actually processed about 100ms later, while it may not be necessary anymore at that time. However, as the message queue is designed as LILO (I may hope so), this won't be a problem.

Biplab:

--- Quote from: bughunter2 on March 08, 2007, 10:31:20 pm ---What I mean with the lag is, something of 100ms ago is actually processed about 100ms later, while it may not be necessary anymore at that time. However, as the message queue is designed as LILO (I may hope so), this won't be a problem.

--- End quote ---

AFAIK, the if you set update interval, UpdateUI event will be sent to the window only at those intervals. So in between these time window should remain idle. But I'm not sure how it has been implemented in wx. :)

bughunter2:
Yes, but meanwhile the window is idle, aren't there messages queued for the next update?

EDIT: by reading the previous posts, I see the update thing is something in wx itself. Now I understand it'll update every 100ms but of course won't queue hundreds of update messages. Thanks Biplab ;)

Navigation

[0] Message Index

[*] Previous page

Go to full version