Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Control Center on macOS is always re-rendering its SwiftUI causing 1% CPU load (twitter.com/praeclarum)
221 points by atomlib on Sept 26, 2023 | hide | past | favorite | 138 comments


I am currently at war with google docs and notion re: memory usage. gmail takes something like half a gigabyte of memory. I had a notion database where each time it loaded an additional 25 rows, memory use went up 400MB. It only got up to 200-300 rows total before it died.

I gave up Sublime because of memory usage, but the alternatives aren't much better. I'm getting ready to trade in my 8gb Mac for 24gb to help with this, and if I could get more without having to pony up for a CPU I don't need, I'd get 32gb, or even 64gb.


To be fair, 8gb hasn't been quite enough for most dev work since containers and VMs became a standard way for local builds and runs.


I don't think it's an excuse for Notion. It's not like it's spinning a new container for each and every database row.


You never know, maybe that's their row microservice.


Or the overheads for communication between the row and column services, the latter being spun up dynamically based on the column count.


I can no longer detect satire


I do heavy dev work on an 8GB M1 Mac. Like, dozens of Chrome tabs, multiple IDEs, Notion, Slack, etc. Works great. MacOS does a good job at compressing memory and using swap. The SSD on an M1 Mac is basically DDR2 speed, so even if you're mostly running on swap programs still execute fast enough.


>> I gave up Sublime because of memory usage, but the alternatives aren't much better. I'm getting ready to trade in my 8gb Mac for 24gb to help with this, and if I could get more without having to pony up for a CPU I don't need, I'd get 32gb, or even 64gb.

> To be fair, 8gb hasn't been quite enough for most dev work since containers and VMs became a standard way for local builds and runs.

It's 2023, and as a typical software developer, I think it's pretty reasonable to require a minimum of 16GB of RAM to just edit text. /s


“You silly kids and your 16GB of RAM! Back in my day, we got by with 32KB!”

The reality is that software is increasingly more complex and even simple tasks require more and more resources as the cruft builds up.


> “You silly kids and your 16GB of RAM! Back in my day, we got by with 32KB!”

Did I say everything should run in 32KB of RAM? I did not. Perhaps now you can be serious instead of sarcastically and tendentiously avoiding the topic of discussion?

It's reasonable for a text editor to use far more than 32KB of RAM, but it's not reasonable for one to not run well on a system with 8GB of RAM (unless the user is editing some massive files).

> The reality is that software is increasingly more complex...

That's true, but also vastly overstated as an excuse for laziness and lack of care.

> ...and even simple tasks require more and more resources as the cruft builds up.

Now you're getting somewhere. There's no good excuse for most modern programs requiring so many resources.

The reason is software engineers are actually terrible at their jobs, and the profession (and its backers) embrace a lot of terrible ideas and excuses. Among other things, the end result is programs that (seemingly more often than not) expand to waste the resources available until performance drops to the minimum acceptable.


The alternative isn’t always “people just need to be better at their job”. Sometimes the alternative is that the thing you like to use never gets built at all because the cost of building it “right” would be prohibitively expensive. It’s always a balance.


yeah I'd like to see MS-DOS edit.exe do what sublime does, or open files larger than 16kB or whatever the limit was for that thing.

very light memory usage though, so modern software is obviously so much worse.


Consider BBEdit. I’ve been using it a lot more these days, now that its competition has skyrocketed in CPU / memory.


BBEdit has been my go to for a long time, as a person who came from Windows, it was a good replacement for Notepad++.

I'd love to buy it, but while I'd be happy to pay 99 bucks for a perpetual version with upgrades, I'm not willing to pay 50 dollars every unknown amount of time. Even if I might pay that for a known 5 years worth of updates.


For the gmail issue, I feel like I might as well plug http://mimestream.com, a gmail client that is a pleasure to use & efficient.


Might have considered it, but saw the subscription-only pricing and left.

General unsolicited advice to desktop application vendors: unless you have the market size and monopoly of Adobe, Microsoft etc, go with one off pricing.


I tend to apply this thinking to my software purchases as well, but in the spirit of conversation I’ll offer that I also make exceptions for software I find to be 1) fantastically good _and independent_, or 2) only make sense with an Internet connection and/or requires or includes some kind of vendor-specific remote service.


And written using Mac APIs, not Electron


I thought Sublime was one of the efficient ones


Theoretically it is, but on one Linux computer I have it freezes from time to time, whereupon it stops redrawing frames, resizing the window results in gray rectangles etc. I think it’s caused by a slower disk, which is sad, because I don’t think that’s a legitimate reason for a UI to stop working. I can accept having to wait when opening a file, but the UI completely freezing is unacceptable. I typically close and open it again in those situations.

It still has a faster fuzzy file search than anything available in Emacs, which is why I stick with it.


I think it is, or at least I use it all day every day and its memory usage is good for me.


I second this. Sublime text is one of the faster text editors out there. It boots fast enough that I use it as my go-to notes app.


It’s fine, speed-wise, but I saw enough memory usage to look for alternatives.


How many of these problems can be overcome by simply running the tools in the browser and not as standalone apps?


For electron-based tools that were designed as web-first apps, I agree with you that it's better to have them in a browser tab than as standalone apps.

However, for real desktop tools that utilize the operating system's bells and whistles, which truly make an app a desktop app—like Sublime—I'd never use an alternative in the browser.


> However, for real desktop tools that utilize the operating system's bells and whistles, which truly make an app a desktop app—like Sublime—I'd never use an alternative in the browser.

I such cases I would also never favor an Electron app posing as native software.


In Safari or Chrome, none of them.

Arc seems somewhat resistant to large memory grab issues, but the Notion database kills it as well.


TLDR; do not trust Activity Monitor.

> I gave up Sublime because of memory usage

Isn't this just because of GPU-mapped memory/textures? Because you can't get much better with any other app, for example text-rendering is not a solved problem yet, there are few nice tricks but they always come with some tradeoff so if you want to support non-english scripts, you usually just go with glyph atlas which needs to include 1:1 glyph-size (retina is big) + up to 3 extra variations because of kerning for each used glyph. System apps do not report this if they are using cocoa but a similar overhead is still there.

Or because of the emoji font, which alone takes 200M!!! And if your app opens it (just to support emojis, not necessarily to draw them), it gets reported as its own memory even when it's usually mmapped and shared between processes (and might not even be loaded in the memory).

What kind of memory usage are we talking about? And how did you measure?


Sublime with no windows open: 410mb of memory

CotEditor with no windows open: 80mb of memory

BBEdit with no windows open: 85mb of memory

In the Activity Monitor.


I guess it varies... I have ~50 files open in sublime right now, mostly small, but some fairly large (e.g. one is 600K), and I'm seeing 279MB in activity monitor. It was less, but I cycled through all my open files just to keep it honest.

Of course, there are a million different workflows people use, not to mention different plug-ins and language packages, etc., so it may just not work for you.

But I don't think there's really an inherent problem.


That's fascinating. I wonder what's different between your situation and mine. You're on an M-series Mac? Current MacOS?


Yes, it’s an M1 (the lower-end Studio one), and Monterey.


oops, I mean Sonoma -- whatever the very latest is. Sorry, I can't keep these names straight. I was installing betas on this machine, so I had the final release somewhat earlier than the official release since the beta RC2 and final release were the same.


So? 410M is reported, it does not mean it's actually used.

I'm not sure if you are familiar with how virtual memory works but if you are, then I don't understand what's your point.


Turning off "Display the time with seconds" lowers the 1% CPU load to 0% for me.


When Microsoft finally added official support for that feature, people were mocking them for how long it took them, "how many resources could it possibly consume". Here we see the result.


Settings > Control Center (scroll down to bottom) > Clock Options > Display the Time in Seconds


Nice find. I always have seconds displayed, but disabling it reduced the CPU load to 0%


Just be aware that 1% on modern multi-core systems is not a lot. The macOS activity monitor doesn't calculate the average percentage over all cores, instead (AFAIK) a process on e.g. a M1 Pro/Max can use up to 1000% if it utilizes all 10 cores.

Stuff like this will be run on the efficiency cores, I doubt it will have a lot of impact on anything.

You can see the usage of efficiency vs performance cores by using Activity Monitor => Window => CPU History


1% is still a lot for power saving. If the system is idle, it should be at 0%. If it is anything above, then it shows poor design.


Realistically no modern consumer OS is ever at idle for long.

It's constantly monitoring WiFi signals, battery level, checking for background processes to run, and a hundred other things.

Whether CPU usage is being reported as 0% or 1% averaged over the course of a second doesn't have anything to do with poor design. It's just being rounded from values like 0.3% or 0.8% anyways.


Monitoring Wi-Fi signals is, afaik, something that happens on the Wi-Fi chip itself, not the CPU.

While you’re correct that nothing stays truly idle, the modern design is that the main CPU really does stay largely idle because of the power costs involved and instead dedicated microprocessors absorb the load when possible.


Sure, but most modern OSes would inform the user when the WiFi connection dies - so there's something happening on the CPU too.


On a state change, sure. But you're not frequently gaining & losing WiFi access.


The only state where a modern computer is "idle" is when it's turned off.


You can’t really make this claim without measuring the actual impact, especially on a system with frequency scaling and 8+ heterogenous cores.


It's only a fraction of the CPU's power, sure, but it's still consuming power (electricity & processing) without actually doing anything, which is wasteful. And every small inefficiency adds up over the scale of everything.


Perhaps but this thread and discussion might add up to a year's worth of that waste.

Just saying every little thing counts can be very misleading, even though inarguable in theory, and result in non-obvious inefficiency.


> Perhaps but this thread and discussion might add up to a year's worth of that waste.

Don’t forget about the number of macOS users. A lazy search says ~100 million in 2017.

Apple talks a lot about their environmental impact, they spent like 10% of their last event talking about it. So I think it’s fair to criticize them being wasteful here.


in this example it's showing the seconds on the clock, which might be useful to some. (Just pointing out that using < 0.1% of the total CPU (depending on how you'd weight the efficiency cores) should not be a dealbreaker if you like this feature)


I have the clock disabled entirely and it still sits at 1% CPU.


or change it to display the analog clock instead


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.


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.


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


Looks like it only applies to people who have the time set to display seconds.


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.


It's kind of crazy how broken some things like stage mangler are. It's like it has never been used once.


I turned on Stage Manager around the time it was implemented in macOS, to try. I never turned it off. It has addressed pretty much every window management woe I had.

Furthermore, I am impressed how they nailed it from the first time: there were no changes since it came out that I noticed, nor would I want any.

There was a slight learning curve, you need to have a good mental model of how it works, but after a day I cannot imagine going back.

(I hate using it on iPad though.)


> It's like it has never been used once.

This may be the case. I worked on a website at work, but never really used the website. One day I was watching someone use it and noticed a bug. I asked the person if they had ever seen that before and they said all the time. I asked them why they didn't report it and they said that they knew we were busy and didn't want to bother us.


I could never get this sample trace despite many attempts. Clearly there is a feature that triggers this behavior, or it has been fixed in the latest OS update. Given the enormity of an operating system and its many moving parts, things will fail occasionally.


Same here: 0% CPU, macOS 13.6, M1 MacBook Pro


0% too, I am on Sonoma RC.


Same here


That's probably a good amount of battery life that can be claimed back once this is fixed


The fix will be ready for the next macOS Apple Event so that they can claim battery performance improvements


Meanwhile Apple is the company most actively working on better battery performance, less memory utilization (e.g. compressed memory) and other such changes...


> compressed memory

doesn't solve much and it's been available in all other OS for a long time.

many reported that compressed memory can negatively impact performances in certain scenarios

For example

https://github.com/microsoft/Windows-Dev-Performance/issues/...


Don't know how compressed memory works for in Windows, but on macOS its role is equivalent to swapping. No memory is compressed unless pages are evicted due to not being used. If memory compression wasn't present then it'd been swapped to disk.


Sounds exactly like zswap. Are there differences that make it better?


Not that I know of. What I don't know and which might make a difference is when evicting to disk, zswap decompresses and swaps to disk uncompressed† as if swap wasn't there, while macOS might (or might not) disk-swap it compressed (so, a bit by bit copy), minimising CPU, IO, and size (and wear for SSDs) at the cost of decompressing when paging it in again.

† Unless the underlying block device backing the swap device or file does transparent compression, in which case it gets decompressed by zswap then compressed by whatever (e.g LVM compression).


> No memory is compressed unless pages are evicted due to not being used

It's the same in Windows.

You can't enable memory compression in Windows unless a page file is present (have not used Windows in 10 years, but that's what I gathered from researching the topic)


MacOS had compressed memory for at least a decade


I know. Your point being?

Did I say that only recently they started optimizing things?


CPU usage isn't equivalent to power usage, so this should have no practical effect on battery life.


Fixed ? This is modern UX design.(drawing the whole screen when the cursor blinks)


It's not a UX issue whether to redraw a larger area than where the changes are.


Can't reproduce this on macOS Ventura 13.6 on a Mac Studio.


Me neither, M1 MacBook Pro with Ventura 13.6, Control center is only 0.1% CPU.

After switching to M1 I haven't looked at Activity Monitor for a long time, as CPU was never my issue. I just realized Microsoft Outlook uses 43% CPU, very astonishing given just one exchange email account is in there.


Me neither (both Monterey and Ventura sit on 0%). Maybe it depends on the items you have in there? I don't think I've ever made any changes.


13.5.2 on Mac Studio and I def see it at 1,0 to 1,5 when not using it. Will update this mac later.

13.6 on my M2 MacBook air: 0,8 tot 1,1 when idle, not using.



It's the Apple feedback thing. https://developer.apple.com/bug-reporting/ They're not public of course, because it's an apple thing.


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.


I'm on a client laptop today. Same 9750H processor, Windows 11 Pro.

Task Manager using between 0.3% and 0.5% while open here.


Open Task Manager, focus a different window and wait 5 seconds. 0.x% CPU usage.


Is Swift UI the problem here? Sounds like the compositor or equivalence isn't doing its job


The compositor doesn't render, Swift UI does.


I assume the window manager/compositor should not've asked for that buffer in the first place.


What does "even though there is no UI visible" mean?


Control Center is an overlay that is only shown when the appropriate icon in the menu bar is clicked. https://support.apple.com/guide/mac-help/mchl50f94f8f/13.0/m...


Control center is responsible for drawing a bunch of the ui on the top right of the menu bar, things like the clock (many comments here seem to be saying this is related to showing seconds), Wi-Fi, sound settings, etc.

It also shows the annoying overlay bit when you accidentally open it :D


Indeed! When "Display the time with seconds" is enabled for the menu bar clock, Control Center sits at 0.8% CPU activity instead of 0.0% on my Mac.


I think part of the confusion is that there's the feature "Control Center" and the process controlcenter so you would reasonably think it's only involved in the marketing feature's UI.


Couldn't it render on demand (on click)?

Or when the mouse starts entering the target before the click at least?


It could. That’s the point


Control center is one of the worst parts of my macOS usage. It keeps taking seconds to (abruptly) show up and on my multi-monitor system it sometimes shows up between corners or on the opposite site of the monitor I activated it on.

I wish it could be disabled and the controls put into the menu bar, but infuriatingly you can't.


Go try and use it with any part of the keyboard, too. It’s jarring how rapid the backslide on accessibility and interface standards macOS has been.


It's just another reminder that Apple, like all other big tech companies, is full of mediocre software teams working on unreasonable deadlines.


In fairness, none of the options present in Control Center are exclusive to it. Everyone one of the options is available in System Preferences (with full keyboard support) or elsewhere.


Yeah, instead of having keyboard users do the normal thing to check their WiFi, interacting with the menubar, they should instead, every time, 1. Open System Settings; 2. Type Cmd-F; 3. type "wifi"; 4. press Tab 2 times


You mean like every other OS? On Windows, you have to press the Win button, go to Settings, tab over to Network, tab over to Wifi.

If you were such a keyboard expert, you'd know that you can 1. Press Cmd+Space 2. Type 'wifi' 3. Do whatever you need to do.


Other operating systems having a bad accessibility story is pretty poor justification for Apple backsliding on theirs.


It's not a backslide, though. Control Center has never been accessible by keyboard and neither is the menu bar unless an app has a specific shortcut key.


I've been using a mac for decades, but had no idea what control center was until about 1 minute ago when I read your comment and googled it. What in the world does control center provide that you find so essential?


AirDrop settings?


I just open Finder, select Airdrop from the left menu, and... that's it.


I wonder if this is a bug introduced in macOS 13 (Ventura). I've been watching the Activity Monitor inspector for Control Centre on my 2017 Air, running 12.6.8, and it's at 0.00, occasionally boosting up to 0.01.


This is 1% of the current load, not 1% of CPU capacity.


Yea anything that unnecessarily updates the screen has lots of unexpected power consumption effects. For example, it might prevent the CPU or display itself from entering lower power modes.

Everything in modern systems is super optimized for the case where the screen is mostly static.


I hope this get fixed asap, that’s ridiculous



> Modern cars work, let’s say for the sake of argument, at 98% of what’s physically possible with the current engine design. Modern buildings use just enough material to fulfill their function and stay safe under the given conditions. All planes converged to the optimal size/form/load and basically look the same.

Is this all true? I'm somewhat sceptical of extrapolating that broken processes and waste don't also occur in other industries. A quick Google search says around 30% of building materials delivered to building sites is wasted. I've also seen some pretty impractically designed buildings in my city that probably waste a lot more energy and people's time than they should.


"let's say for the sake of argument" is doing a fair bit of work here. But the point is that we had text editors (similar to the ones we have today) back when CPUs were capable of maybe a few millions of instructions per second. CPUs can now do tens or hundreds of thousands as many instructions, but a text editor today uses several percent of that CPU.

That would be like shipping a square kilometer of forest to the job site to build one house.

The construction industry and modern cars could be more efficient, but their waste is measured in percent, not orders of magnitude.


Modern software is trying to solve for a different efficiency: developper time.

Whether or not those efficiencies are achieved is left as an exercice to the reader.


Every time this site is linked I toggle the dark mode icon, it has never failed to make me laugh.


Imagine how snappy Snow Leopard would be on an M1


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 wish someone did an analysis to determine why my intel-based macbook is so incredibly laggy all the time, even after fresh system installation. I can't shake the feeling that Apple Silicon is so much faster that performance issues just got into the system without anyone at Apple bothering to fix them, and Intel macs suffer as a result.


My wife’s Intel-based laptop got considerably slower in the last year or so. I tried everything I could but nothing seemed to return it to its original performance.

Then she got a warning that the battery needed servicing. After getting it replaced (and the Apple employee warning us several times that it might not help performance), the laptop was back to its previous state. My theory is that the battery running warmer was causing the CPU to throttle. Or perhaps cleaning out the machine while replacing the battery helped it thermally. Or maybe both.


Interesting, how old was it? Do you recall how many cycles the battery was at? Unfortunately throttling is unlikely in my case, at least for the lagging I observe day-to-day, I don't see any throttling via `pmset -g thermlog`. I did wonder if changing thermal paste would help, but since I don't observe throttling I'm not sure it would


I believe we purchased it around 2018 or so. I didn’t look at the power cycles, just got the warning about needing maintenance.


It's overheating and the (my) problems came from:

- loading the battery and powering the device

- high gpu power usage when plugging in a external monitor

- cpu power usage

- bad cooling which must be cleaned often

My recommendations:

Plug in the power from the right side. Afaik the thermal throttling kicks in sooner if you have it plugged in on the left.

Clean the device. Unfortunately it really sucks to open it. You will need special tools and lots of trust in the spaghetti monster that you dont break anything.

Cpu power usage can be lowered by using any of the tools:

https://github.com/sicreative/VoltageShift

https://volta.garymathews.com/ (most probably not working anymore)

Unfortunately in later updates apple prevented undervolting the cpu so it's (VoltageShift) use is limited now. But i was able to limit the power usage to 5W, which somehow helped keeping my device cooler. Be aware that you need to disable quite a lot of security measures to install Voltageshift.

Apparently having power saving active even when plugged in helps keeping the cpu and gpu cooler. I did not test this extensively because i switched to a m2.

A big problem comes from the gpu, if you have an external monitor plugged in, the video drivers start using 10W+ which causes problems when you are loading the battery as well. There are a lot of discussions on what causes the problems, it has to do with the drivers and some screens causing it to use way more power then needed. It can help to close the lid of the macbook while working with a external monitor.


Thanks for the suggestions, this all sounds plausible, however: - I routinely clean, or at least de-dust everything accessible after removing back cover - the lag is there always, even right after resuming the mac, before any thermal throttling should be kicking in. I also don't observe throttling with `pmset -g thermlog` - I'm not using an external monitor

At this point the most likely culprit is the battery, mine is at 789 cycles although the condition is reported as "normal". I wish it were possible to confirm whether battery is an issue before spending couple hundred $ on replacement though


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.


They’ve all been electron based. The only meaningful change was the arm64 builds that came out last year.


I just wish people would stop blaming Electron for everything.

Teams isn’t a buggier, worse performer than VSCode or Slack because of Electron.


Best way to use Electron stuff, is via the Web app.


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.”


As a Teams user on the crappy PCs the company gives, this is an argument I can get behind.

It looks circular but there are implicit meanings hidden there:

"Teams is bad (not only) because it’s slow. It’s slow because it’s Teams. (as in, Teams has a looong list of defects, slowness just icing on the cake)”


Yeah fair.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: