Skip to content
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

[Issue]: Mouse movement tracking consumes a lot of CPU #1747

Closed
Caellian opened this issue Feb 25, 2024 · 4 comments
Closed

[Issue]: Mouse movement tracking consumes a lot of CPU #1747

Caellian opened this issue Feb 25, 2024 · 4 comments
Labels
bug Bug report or bug fix PR triage Issue that hasn't been verified

Comments

@Caellian
Copy link
Collaborator

Caellian commented Feb 25, 2024

Description

As noted by siliconsniffer in #1742, tracking global mouse movements with XInput consumes a lot of resources (50% of CPU in their case).

This might come from some different change in 1.19.7, but I think XInput is the cause because it produces a lot of events (almost one for every pixel of movement).

I'd like to discuss possible solutions:

  • Disable XInput support by default (fallback code is already in place, inaccurate enter/leave tracking on most WMs).
  • Throttle processed events
    • Track last event time. Avoiding forwarding to lua handlers could help a lot.
  • Simplify logic for enter/leave checking.

Version

1.19.7

@Caellian Caellian added bug Bug report or bug fix PR triage Issue that hasn't been verified labels Feb 25, 2024
@siliconsniffer
Copy link

#1745 fixed the issue from #1742 for me, as stated in #1748 .

@Caellian
Copy link
Collaborator Author

@siliconsniffer So conky no longer uses 50% of your CPU?

If you have xcb-util-errors installed, your local build will be different from official arch package (which is compiled without it). Building from source even without the PRs completely avoids problematic code if you have xcb-util-errors as conky detects it at compile time.

@siliconsniffer
Copy link

Nope, no 50% CPU usage anymore, except only if I move my mouse very quickly between the windows, but that's probably my compositor or wm, not a conky issue (I think).

I don't have this installed, how does it avoid problematic code?

@Caellian
Copy link
Collaborator Author

Because conky detects xcb-util-errors at compile time and uses it for error reporting (nice, descriptive error messages) instead of a manual implementation (raw error codes) which previously used wrong buffer sizes for formatting (thus buffer overflow).

It might be just that the error callback was slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR triage Issue that hasn't been verified
Projects
None yet
Development

No branches or pull requests

2 participants