CPU increase when making GUI elements non-visible

I’m finding that I’m getting a CPU INCREASE when I make some elements of my GUI non-visible. I’ve tried disabling timers in the GUI elements, to no avail.

I’d very much appreciate if anybody has any suggestions.

That’s impossible to guess. I can only say thats not normal.

  1. how do you measure the CPU increase? CPU meter of Xcode or Activity monitor?
    mind you that this is not a good test.
  2. what I could imagine (wild guess) something that was throttled by using real gui now spins up, because it lacks the slowdown (like calling repaint in a loop)

I can only say that this is not normal

Like I said before, no chance to answer without the code and/or running it in a profiler

1 Like

Hi Daniel,

Thanks a lot for responding.

  1. I’m looking at the cpu usage in Reaper but I also get the same results in AUM on iOS
  2. I’ve completely gutted my PluginEditor to the point that there is nothing in it except empty paint and resized methods. The bizarre thing is that, having done that, my cpu usage has almost doubled!

Also, with the same gutted PluginEditor, if I use a timer and put some arbitrary heavy calculation into it (an extremely long loop adding integers) the cpu usage drops dramatically!

To summarise:

  • GUI with all elements visible --> 1.7% cpu
  • GUI with some elements non-visible --> 1.9% cpu
  • gutted PluginEditor --> 4.3% cpu
  • gutted PluginEditor with heavy timer --> 1.5% cpu

I have no idea what’s going on.

M

To be honest, those readings happen in the noise floor of the activity, IMHO they are pretty random.
Is the 4% posing a problem for your product?

Also worth asking:

  • is this a debug build? In which case it is even further from reality.
  • did you make sure that this “heavy calculation” wasn’t optimised away in a release build?