High cpu usage (energy impact) on M1 macOS (progress bar animation never stops)
The Quassel client shows up very high in the MacOS activity viewer as using a lot of energy. Checking the CPU usage, it seems to be using 7-14% of an E-core all the time.
The actual wasted energy usage isn't that high, only about half a watt. But still.... PowerMetrics reported Quassel was getting about 61 wakeups per second, which indicates something is triggering redraws.
I tried a few things to try and fix this. I assumed it was related to Rosetta, and made a native Apple Silicon build, which reduced the cpu usage by about half, but still way too high. I hacked together a Qt6 build, because I thought it might have been an issue in Qt5. Didn't fix it.
I tried profiling, but that seemed to indicate the redraws were coming from within cocoa itself. Eventually I got desperate and started commenting out various bits of code and eventually tracked it to the backlog loading progress bar in the status bar. If you disable the status bar in the view menu (and restart Quassel), the issue goes away. The progress bar is briefly shown during connection, and for some reason it causes cocoa to trigger a redraw at 60fps for the rest of time. Even after the progress bar is hidden again.
Some googling brings up this old bug: https://bugreports.qt.io/browse/QTBUG-20880 that seems to be related. But it's meant to be fixed, and the current stylesheet doesn't even have an animation for the progress bar.
I also tried a few code workarounds: Resetting the progress bar, setting the max to 0, setting the progress to 100%, removing the progress bar from the layout and deleting it... nothing seemed to return the cpu usage to normal. The only "fix" was to never show the progress bar in the first place.
Disable the Status bar in the view menu and restart Quassel.