shirsig / aux-addon

Auction House addOn for Classic (1.13) IMPORTANT: The folder name must be "aux-addon" IMPORTANT: The Vanilla (1.12) version moved here https://github.com/shirsig/aux-addon-vanilla
https://www.curseforge.com/wow/addons/aux
196 stars 42 forks source link

relatively high CPU usage while in the background doing nothing #310

Open kotarac opened 3 years ago

kotarac commented 3 years ago

Hey there!

I regularly profile addon CPU usage (for no particular reason) using https://www.curseforge.com/wow/addons/addon-usage.

I've noticed aux uses around 4-8 ms/s (milliseconds in a second) of CPU cycles while running in the background, no AH open, quite a bit after a fresh UI load.

Here's a screenshot of Addon Usage: image

Quickly glancing at the code, I've noticed this is likely due to 2 unthrottled OnUpdate hooks in https://github.com/shirsig/aux-addon/blob/master/control.lua#L8 and https://github.com/shirsig/aux-addon/blob/master/control.lua#L55. Doing a quick hack to throttle them to run at most once every 0.1s helped a lot and got it to consistently below 1 ms/s.

Now I imagine throttling like above would probably impact the performance of various addon operations (I've noticed these hooks coordinate listeners and coroutines).

What are your thoughts about this? I'd be willing to get a PR up for throttling (perhaps configurable), if you think that's the right approach, and think this is an issue worth fixing.