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

reduce CPU usage #45

Open
correabuscar opened this issue Mar 10, 2023 · 3 comments
Open

reduce CPU usage #45

correabuscar opened this issue Mar 10, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@correabuscar
Copy link

correabuscar commented Mar 10, 2023

On Windows even if auto-clicking isn't enabled, due to egui/eframe it seems, there's something like 6% CPU usage(on 12 cores cpu (6+6)) constantly(more or less) but which noticeably turns on CPU fans to audible sounds for me, compared to when rust-autoclicker isn't running at all.

this probably cannot be fixed... i don't know.

EDIT: it's less noticeable if build with --release
EDIT2: even with --release but in Gentoo Linux, the cpu usage is between 18.8% and 20% constantly, as reported by top, and makes X process stay at a constant 9.9% to 10.9% as well instead of the usual 1.0% to 2.0%. But at least in Linux here the fans aren't spinning up and it seems the cpu speed isn't going higher than the minimum of 800Mhz (when using the powersave governor)

@MrTanoshii MrTanoshii added the enhancement New feature or request label Mar 10, 2023
@MrTanoshii
Copy link
Owner

I see what you mean

Tested quickly using the trusty windows task manager on a i7-7500U CPU

Unfocus:

  • Low: 1%
  • Avg: 4%
  • High: 8%

Focused (Idle & autoclicking):

  • Low: 28%
  • Avg: 31%
  • High: 32%

Seems to be an issue of the app doing too many things when focused, I'll look into slowing things down when not autoclicking. Maybe the refresh rate is too high?

@MrTanoshii MrTanoshii added the help wanted Extra attention is needed label Mar 10, 2023
@correabuscar
Copy link
Author

correabuscar commented Mar 10, 2023

I have noticed that this https://github.com/emilk/eframe_template doesn't use any CPU at all(on Linux), so maybe it is possible to reduce the refresh rate as you say. Or maybe somehow only update when needed, although, you're showing the current mouse coords in real time.

My problem was mostly when unfocused and not autoclicking, and it's mostly 2-3% cpu usage with --release now, when unfocused and idle. I don't hear fans spinning up now. Don't try it without --release :)

@MrTanoshii
Copy link
Owner

Performance may be improved by following recommendations from

imgui-rs/imgui-rs#678 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants