Make IdleWatcher checking idle more often to speedup IdleTasks
Make IdleWatcher
check idle status with x20 frequency. This will solve the laggy Overview and Histogram docker.
The default value of delay
was used by Overview and Histogram widget. But the current logic will take 4×200ms = 800ms to get the IdleWatcher gives out a Idle Signal, which is too slow and having a noticable laggy. The modified version will have 4×10ms = 40ms delay which is quite fast comparing to 120ms which is the response time of most best athletes.
See discussions on Krita Artists forum.
For performance, the IdleWatcher
is shared through the ViewManager, and there will be only 1 watcher for these tasks. Idle status check is quite a fast task and I think this is just a logic problem. It doesn't need that long to wait image to be idle checking 4 times, and it works well for me(see the demo and the test plan).
Test Plan
- Try to draw a stroke and now Overview and Histogram should refresh almost instantly after the stroke ends.
- On a larger canvas(5000x4000) and draw with a huge wet brush(1000px), the Overview and Histogram will still refresh almost instantly. (Tell us how to test the changes you made.)
- All unittest result won't change after this modification.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy. -
Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?
Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.