Neuron

Neuron

98.2k Downloads

Neuron CPU usage is a bit high

brittyazel opened this issue ยท 5 comments

commented

We should try to optimize the CPU usage of Neuron to be optimized. Right now Neuron is sucking up about 5fps on my system, but it could be higher on lower end systems.

I need to figure out how to profile the addon to figure out where the high cpu usage is coming from.

commented

Most of the CPU instensivity seems to be attributed to OnUpdate calls, I.E. anything tied to a SetScript("OnUpdate", bleh). I believe the way these work is that any function tied to an OnUpdate call is called each and every rendered frame, which is super wastefull.

That being said, one OnUpdate call inparticular seemed to have been more damaging than others, and it was the Macro_OnUpdate in the Neuron_Buttons.lua file. Disabling this argument drops our CPU usage from ~25ms/s to ~5ms/s, for just about 80% less CPU usage.

commented

I don't want to close this, we need to go through the code with a fine toothed comb to optimize it, but this was a good start.

commented

Profiling this addon a little, it seems like it currently prefers running the expensive OnUpdate work every N frames -- this will cause people who are already at their frame budget to have a jittery framerate/microstuttering.

A number of these are doing per-button work, in which case a better solution to the current throttling would be doing 1/20th of the buttons each frame, rather than an update every 20th frame.

commented

This is an excellent point, spreading out the work between cycles should smooth things over a great deal. I need to think about how to make this possible

commented

This is fixed.