-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Perf] Reduce the amount of time the EVENT_OBJECT_LOCATIONCHANGE hook is enabled #1264
Comments
Thanks @TheMrJukes this is a great improvement! |
putting in 20.03, we may be able to pull this in sooner per @enricogior |
I've rebased the branch to the current master (cherry-picked line by line manually, because every commit had a conflict almost in every file) and considered the proposed idea. It looks like we need to at least partially implement #961 for it to work, so I'm reestimating this a bit. What we need to do:
To finish #961:
I've just finished drafting the design, but need to test some concepts, though it seems like a viable task for 0.16 nevertheless. |
moving this toward 0.18 and 0.19 to wrap up. will be done with setting simplification work |
The fix is now available in 0.18 https://github.com/microsoft/PowerToys/releases |
Summary of the new feature/enhancement
Simply moving the cursor is enough to generate an EVENT_OBJECT_LOCATIONCHANGE.
Last I checked, PT registers for EVENT_MIN/EVENT_MAX in SetWinEventHook.
You'll notice that moving the cursor around the screen quickly is enough to spike PT CPU usage to 3-5% depending on the PC.
The idea is to reduce the amount of time PT is spent registered to receive EVENT_OBJECT_LOCATIONCHANGE and other events it does not need to process.
Proposed technical implementation details (optional)
TheMrJukes/PowerToys@master...TheMrJukes:user/bretan/pt-optimize
This is not completely ready to ship but I haven't had time recently to fully finish it up.
The idea is that we ask each powertoy exactly which events it needs for SetWinEventHook.
This way we only register for the required events.
It is more efficient to have 30 hooks registered for the specific events necessary than it is to have 1 hook registered for a larger range of events. The overhead of having a bunch of hooks enabled to the kernel is minimal.
It also provides a callback to allow the powertoy a way to change which events it requires. This lets FZ only request EVENT_OBJECT_LOCATIONCHANGE while a drag is in progress.
The text was updated successfully, but these errors were encountered: