gazoodle / geckolib

Library to interface with Gecko Alliance spa pack systems via in.touch2 module
GNU General Public License v3.0
62 stars 24 forks source link

Optimise CPU usage - tweak ASYNCIO_SLEEP_TIMEOUT_FOR_YIELD #31

Closed Ghawken closed 5 months ago

Ghawken commented 2 years ago

Hi

Well done on this library - it works really well and obviously a lot of low-level capturing needed - Well Done!

I'm using it for a non-HA home automation plugin for Indigo (using python3). All going pretty well, despite the async slight hurdles at my end..

I have noticed that CPU usage in my scenario sits around 15% for a mac Mini doing little else. If I increase further your

const.py: Line: 18 ASYNCIO_SLEEP_TIMEOUT_FOR_YIELD to 0.1 I can drop CPU to less than 0.7% ?

May be a possible tweak for other systems? As likely a sweat spot here somewhere. Food for thought perhaps?

Thanks

Glenn

xela1 commented 5 months ago

Well, I wish I looked here before spending a couple of hours tracing this (starting at home assistant) to exactly the same place, and coming to exactly the same value too :), not sure the code is still being maintained though, I'll have to fork I guess

gazoodle commented 5 months ago

I’ve been sucked into another major project for the last 18 months and haven’t had the time to spend at all on the Gecko library of the HA integration, but that is coming to an end soon and I hope to be able to do some trivial maintenance late autumn (before the 2025.1 HA deadline for a couple of deprecation warnings), and then move on to some of the backlog.

xela1 commented 5 months ago

I’ve actually just done a PR for the deprecated constants if you get time to look at that. I think it’s fairly trivial. I’ve been testing it for a couple of days and all seems good. I just found some time today to try and trace the CPU issue

On Tue, 4 Jun 2024 at 18:50, gazoodle @.***> wrote:

I’ve been sucked into another major project for the last 18 months and haven’t had the time to spend at all on the Gecko library of the HA integration, but that is coming to an end soon and I hope to be able to do some trivial maintenance late autumn (before the 2025.1 HA deadline for a couple of deprecation warnings), and then move on to some of the backlog.

— Reply to this email directly, view it on GitHub https://github.com/gazoodle/geckolib/issues/31#issuecomment-2148089149, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACXHR5DADQATLEBEQVANE3ZFX45PAVCNFSM5YQ5VYK2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJUHAYDQOJRGQ4Q . You are receiving this because you commented.Message ID: @.***>

gazoodle commented 5 months ago

Hopefully this is fixed in the latest version