Live data from Hacker News

Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load

twitter.com

31–40 of 145 posts

Re: Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load

#33
post #16

This is such a classic UI programming bug, and almost every UI programming framework has a way to achieve this accidentally using core components. React is notorious for this, but even in non-declarative frameworks it's very easy to get a reactivity loop on a trigger or model update and do this.

It’s way easier in declarative frameworks, though.

Yes, but only because you aren’t re-rendering when data changes (which is half of the entire point of an UI) implicitly. Having worked on enough imperative UI kludge, I think that declarative probably saves enough dev-hours (and associated calories, Typescript, Swift, Rust, etc. compile time) to outweigh the infinite loop bugs.

Re: Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load

#34
post #16

Earlier quoted context omitted.

It’s way easier in declarative frameworks, though.

Yes, but only because you aren’t re-rendering when data changes (which is half of the entire point of an UI) implicitly. Having worked on enough imperative UI kludge, I think that declarative probably saves enough dev-hours (and associated calories, Typescript, Swift, Rust, etc. compile time) to outweigh the infinite loop bugs.

I meant it’s way easier [to enter an infinite render loop] in declarative frameworks.

Re: Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load

#35
post #11

Off topic: I wish someone would do this kind of analysis to determine why Microsoft Teams helper process is always at 50-70% CPU load on my M-Based MacBook Pro. My laptop is warm/hot to touch as a result of it.

Because Teams, and also because Electron.

That’s essentially a circular argument. “Teams is bad because it’s slow. It’s slow because it’s Teams.”

Re: Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load

#36
post #32

1% CPU load? Windows 11's Task Manager sips 6-8% of my 9750H

Control Centre is not related to Task Manager at all though - that would be Activity Monitor (which is the first screenshot, where he shows Control Centre is using 1% CPU).

Control Centre is an always-on process. It sits on the menubar, and provides access to settings like sound, bluetooth, wireless, etc.

Edit to add: On that first screenshot, you can see that Activity Monitor is using 3.4% CPU. In my experience, it fluctuates between 3% and 10% most of the time.

Re: Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load

#37
post #25
post #11

Off topic: I wish someone would do this kind of analysis to determine why Microsoft Teams helper process is always at 50-70% CPU load on my M-Based MacBook Pro. My laptop is warm/hot to touch as a result of it.

I’m not experiencing that issue. Have you tried completely uninstalling it and reinstalling?

I never had this issue when running the Apple Silicon Microsoft Teams version. It actually was quite good, contrary to what most would say.

But after receiving the push update converting Team to using the Electron version of the app, CPU load dramatically increased.

Wish I could convert back to the older Apple Silicon non-Electron version.

Re: Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load

#38
post #34

Earlier quoted context omitted.

Yes, but only because you aren’t re-rendering when data changes (which is half of the entire point of an UI) implicitly. Having worked on enough imperative UI kludge, I think that declarative probably saves enough dev-hours (and associated calories, Typescript, Swift, Rust, etc. compile time) to outweigh the infinite loop bugs.

I meant it’s way easier [to enter an infinite render loop] in declarative frameworks.

I would say it's way easier to define an infinite render loop in declarative frameworks, and therefore it's easier to notice the issue and address it. Causes and fixes are just more obvious.

I don't think it's much harder to infinitely update properties that cause a redraw in a non-declarative framework, but doing so probably has less impact because it often won't redraw the entire screen, and may do less work overall because of how the framework is structured.

Re: Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load

#40
post #17

I see 0% CPU for control center here (13.6) so either fixed, or not always the case.

It must not always be the case. I'm sure they have a power team at Apple who ensure a Mac can sit on the desktop without any CPU wake-ups.

They may have a team, but they actually need to use it. Given the amount of bigger broken things in the new MacOS version, I wouldn't hold my breath.
Post reply on HN