-
Notifications
You must be signed in to change notification settings - Fork 62
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
Relatively high CPU usage (1-2% during every mouse event) #14
Comments
After further investigation I think this is unavoidable because I don't think it's possible to distinguish between mouse gesture events and touchbar events without first creating the |
@chrisballinger Thank you for your investigation, I didn't realize that |
Created #15 for testing. |
I made a very similar patch on a branch that I threw away :) The hard part will be figuring out how to filter mouse gestures vs touchpad gestures from some private CGEvent API without first converting to NSEvent, because that would eliminate most of the noise. Even if you still have to eventually convert the touchpad gestures to NSEvent, being able to efficiently ignore the extraneous trackpad input would eliminate the vast majority of CPU usage since most of the time I'm not using the touchbar. |
@chrisballinger Yeah, that part, differentiating events from Touch Bar or normal multi touch device, requires some undocumented API usages. If you can test this branch and see some benefits, I’m going to merge this. |
I found another potential solution; watch Proof of concept: https://gist.github.com/ghazel/e2e0f2644f816cb4167021a2e0566357 |
Hi! Have you tried the proposed IOKit solution? |
@gch1p Yeah, I tested once and tried to use it, however recently I was a little bit busy and couldn’t have time to work on it. I will give another work soon. |
@niw Just found this app and it's extremely useful! However, I just can't use it while this bug is active, I prefer more battery life than constant loading on CPU. Would it be possible to fix this issue? |
Every mouse event causes the
EventTapCallback
to be called, which over time results in a constant 1-2% CPU usage.I did a basic time profile and found that the main culprit is calling
[NSEvent eventWithCGEvent:eventRef]
, which seems extremely slow for something that I assumed would be "toll-free". There are a few things I'm going to try to reduce CPU usage in the callback, but I was wondering if you had a preferred approach.The text was updated successfully, but these errors were encountered: