91 comments

[ 0.18 ms ] story [ 129 ms ] thread
I know right now it's all anecdata but I noticed this as well! My 2020 M1 Mac's battery life has significantly decreased as well, to the point where I need to charge twice a day like I used to for the old Intel Mac's.

Although this could just be my fault as I've already racked up close to 600 cycles on a machine that has only gotten a year and a half's worth of use.

Wow, that's a lot of cycles! Mine is 11 months old and has 46. I use it mostly plugged in with a second monitor, but I just recently took a trip and never charged it, even though I wrote 2/3 of a new app in Xcode.
Haha yeah! It's nice to see that other's machines are fairing up well. I'm a student so my machine gets a fair bit of wear and tear and theres just not much I can do about that unfortunately.
For another data point, my Dec 2020 M1 Air (which I daily drive) has 195 cycles.
How nice, my late 2010 MBA has 103, and is still on 89% health.
More anecdata: 175 cycles here, 99% max capacity.
My m1 is employer provided, so I always just blame the 10 different security/management tools.
Ah, that's terrible. They just took away my Lenovo laptop with Linux to set me up with a 'platformed' Intel MacBook Pro, and CrowdStrike is eating CPU all the time.

Everything not included in the system (I guess CrowdStrike is checking every executable all the time) super slow. Even doing 'exa -l --icons /' on the shell is sometimes even orders of magnitude slower than my Linux. Around 50ms in Linux, but around 300ms in macOS...

I thinking about setting up everything inside a virtual machine to see if CrowdStrike controls that. It might even be faster.

Is there good virtualization software for m1 yet? Last time I looked it was like "well there's a parallels beta..."
Parallels running ARM Windows (and Linux obvs) is now very good. And if it is Windows you're using, then Microsoft announced (last week?) that it is now a supported platform.

I've used VS2022 (ARM version) with ARM Windows 11 on an 8GB M1 Air, and it's faster than my work 10th Gen i7.

Obviously if you use X86 and AMD64 stuff in that configuration it's running emulated by ARM Windows, but for most non-dev stuff I use native Mac versions anyway and Parallels gives me Windows 11 either full-screen or as seamless windowed apps. It's impressive.

IT sent out a bunch of emails asking us to all set up crowdstrike. I decided to ignore them and see if their threat of checking up on it was fake. 6 months later and nothing. Glad I avoided this rubbish.
I was having similar battery life on my 2020 Intel MBP, and I found turning off the "Manage battery longevity (As your battery ages, maximum capacity is reduced to extend battery lifespan.)" setting improved battery life by an additional few hours.
Running Unity my M1 Air only gets like 3 hours.

Edit: I'm using VS Code as my IDE which seems to be the actual issue.

3.5 hours is still pretty good. Every Dell I've ever had for work is 1.5 hours tops.
Your work is skimping on the battery. My work machine (a Precision 7550) easily runs all work day on battery, even with horrible battery hogs like Microsoft Teams running.

One thing to watch out for: Sometimes the audio driver starts busywaiting after you wake from suspend if you have been using bluetooth. You have to manually kill it in the task manager or it will drain your battery in an hour. You can tell when it happens because the laptop gets hot and the fan starts spinning even though you're not pushing it at all.

That thing is a chonky boy though. My XPS is absolutely absymal with battery life and the Latitudes I had previously were no better.
Small, high power, and long battery life is a choose two situation.
Doesn't seem to be with my new M2 MacBook. It's far more powerful, smaller and has battery life far beyond my year old XPS.
Depends on what apps he's running. I suspect Xcode is pretty optimized (but buggy as all git-go -I should know. I use it all day), but Slack and VSCode are electron apps, and Electron is notorious for eating power.
For me Xcode uses a huge amount of power compared to VSCode with the C++ extension, making it barely usable.
Xcode eats power.
I'll take your word for it. Most of my time is spent on a tethered machine.

I also suspect that it depends on what is being done. I'll bet that some types of languages compile hot, while others, cool.

UPDATE: I just ran Xcode, doing my basic daily tasks (editing and building), using Activity Monitor, and it was pretty mild. It had a HUGE spike, as it started up, then dropped into single- and double-digits, after that.

I wonder if it depends on the codebase in question. I've not had too much trouble with Xcode being power hungry on moderately-sized codebases that are entirely or almost entirely idiomatic Swift with Swift Package Manager handling dependencies.

I could see this being different for a project that's a mix of Swift, Objective-C, C++, etc though or has a lot of messier Swift code of the sort that makes SourceKit grumpy (deeply nested blocks, etc).

XCode is so CPU-heavy that I can often type faster than it can display my keystrokes ...
One hopes that this is always true, if not observably so.
Please elaborate on what you mean.
well it would certainly be weird if the cpu displayed your keystrokes faster than you type.
I think OP's meaning is that he can type two keystrokes sequentially faster than the program can display the first character.
They want it to display the characters at the same speed they are typed. Faster and slower are not the only options.
I spend most of my day in Xcode and the only time I see this is when there's a pane with a file open that has contents that makes SourceKit choke. As noted in on of my other comments, in my experience this is usually caused by code smells like deeply nested blocks, really long optional chains, or lots of casting. SwiftUI can also do it with more complex views, which is one of the reasons I've been sticking to UIKit.
(comment deleted)
It's manufacturer defect, that's too little for such a young machine. Mine is same age and lasts over 10hrs every time.
No, it's shitty Electron apps burning through CPU cycles when just sitting there doing absolutely nothing.
I use the same electron apps, so it’s weird they are having this problem.
Absolutely certain that he's using VSCode.
(comment deleted)
I'm moving to a Mac Mini and an iPad Pro. More expensive? Maybe. I just don't need to carry around an extra keyboard, screen, and battery that could go bad. Tablets are so good these days that laptops make little sense IMO.
I have same issue with my 2021 16" M1.

I bought an iPad Pro recently, so I can leave the 16" plugged in at the office.

Does Mac not have stats for who used what? Does iOS? Even something like powertop?

I'm from the Android world, and that's one feature that -really- helps identify problems, instead of making an overly vague post like this.

Really surprised every platform doesn't have something like that by now...

Yes, activity monitor has an energy tab.
Thanks, guess I should have read more before I commented. He shows a screenshot of it if you expand replies a couple times, and yep... vscode.
(comment deleted)
There's also the powermetrics command line tool. It shows much more than activity monitor. If activity monitor doesn't give you what you need, try it. man powermetrics.
Was planning to write that. Additionally, powermetrics allows you to capture data to a file in either xml or plain text for logging or analysis.
According to the OP, the culprit is VSCode: https://twitter.com/brian_lovin/status/1628505684504625152

On my 1 y/o M1 Air I consistently get over 10hrs mixed use. Coding itself is not compute intensive at all but someone is using some build systems, VMs. Docker etc. these things constantly compute stuff and as a result the battery is decimated.

The modern Dev environments are ridiculous, no matter what people say coding Swift on XCode is a breeze. Even if you do dynamic previews with SwiftUI and use simulators, it's still lighter than some web dev stuff.

My first guess would've been a JetBrains IDE. I don't personally use one but my coworkers are constantly complaining about battery drain.
I keep forgetting to turn off the django dev server launched by PyCharm until I notice that my battery is dropping
Except I run CLion for 8 hrs a day on my newish MBP M1Pro and generally end the day with 20-30% charge left.

Maybe I'm not thrashing it hard enough.

Any good alternatives for C#, or anyway to make VS Code less draining
Rider? https://www.jetbrains.com/rider/

edit: https://github.com/OmniSharp exists, and is LSP-ish, but I have never used it.

JetBrains Rider is a cross-platform .NET IDE based on the IntelliJ platform and ReSharper.

It's been years since I've used Resharper and maybe things have changed, but if you are looking to improve battery life, it's one of the last things I would start using.

I use Rider daily on an M1 and easily get through the day. I'm not compiling every second, but using it pretty consistently along with slack/chrome/etc.
As much as I love Jetbrains applications and use them daily, they are battery hogs. PyCharm will deplete my M1 battery in a handful of hours.
Battery and ram hogs.

My work laptop is often at full ram usage (16mb) with the fans spinning at full speed.

I used to code in vim and sublime text. The change in system load is shocking. I like Rider and will continue to use it but it's crazy how much of a hog it is.

> My work laptop is often at full ram usage (16mb)

At least you've upgraded beyond 640k!

Hahaha, gah, one day I'll learn to proof read.
My guess would be to turn off all features except syntax hilighting. Without that you may as well use notepad.
Get a $10 VPS and use the SSH extension to connect and develop stuff remotely.
> Any good alternatives for C#, or anyway to make VS Code less draining

I've used VS Code, Rider, and even VS2022 via Parallels, and in the end I switched to VS Mac. It had been a year or so since I last really tried it and in that time it had gone native ARM (faster and less battery drain) and been much improved.

Unless I need legacy stuff or Windows-only dev, I now see no reason to use anything other than Visual Studio Mac on my M1 Air for C# development.

It’s not for everybody, but choose a good text editor with syntax features, read documentation and related code, use a lightweight build system, and write without an IDE. It’s really not that difficult, is transferable to any framework or language, and forces you to learn APIs and code bases.

In the past 20 years I’ve used Vim to write PHP, Java, Bash, C, C++, Ruby, Perl, JavaScript, Objective-C, Swift, a proprietary S-expression language, and documents in LaTeX. This isn’t something I drop into occasionally, it’s my primary editor used along side compilers and interpreters. I’ve never once said, Vim doesn’t start fast enough or is taking too much memory (though I have caused it to hang based on my own dumb search or replace commands).

There are plenty of native text editors that work just as well. On the Mac I’ve had great experiences with BBEdit, TextMate, and SubEthaEdit. Other people like Sublime. There really is no shortage of great text editors.

Developers need to start treating electron apps like the plague. They are merely low effort attempts at cross platform tools written in the most user hostile way.

VsCode extensions contribute significantly to battery drain as well. The more extensions you have running, coupled with a larger codebase, the more compute needed to reindex for autocompletion, warnings etc.
Is it just me, or is VSCode kind of confusing on how exactly everything works/integrates? When I've tried using it for Python work, getting it to use the right venv/binary seemed difficult and it has all these add-ons that I don't know where they're installed or fetched from.

I feel old. I just want highlighting and intellisense to work.

> modern Dev environments are ridiculous

Yes they are. But why can my crappy work laptop with an i7-1185 do it then?

> modern Dev environments are ridiculous

VsCode + Docker on Mac + devcontainers (at my last job) make for an atrocious development experience. It was a major contributing factor when I left that job.

And probably a badly behaving extension in VSCode that won't stop indexing or regexing or something.

Because this sounds like constant 100% CPU usage on at least one core.

Right, in this particular case it looks like a VSCode extension gonna wild since the battery dropped in constant pace which is an indication of constant load and the system reports VSCode dominance in energy use.
I mean, vscode's own extensions and language servers crap the bed plenty, though it's gotten much better in the last year or so.
An accidental advertisement for vim
I develop in Python with (neo)vim and pyright as LSP client. Pyright often has regressions where it will consume 100% of one core for about a minute after every key press. The bug usually goes away with the next update... to reappear a few weeks later.

Editors are pretty efficient, linters on the other hand not so much.

Was thinking the same… although Vim plugins are a crapshoot regarding efficiency. Seems like sometimes there’s just no winning move: either you have nice tools and no battery life, or long battery life but subpar tooling.
In absence of other data, I’d check if it’s a VSCode plugin/extension. Or a hung process that’s not showing up in the energy tab.
My M1 MBP hasn't been able to last over 4 hours since I got it... but for work I have to use Slack and Teams.

If I am on a video call with Teams I am lucky if I get 1.5 hours out of a 100% filled battery, as the Teams "helper" sits at 190% CPU usage during the entire call.

Electron applications are wasting so much CPU time and power.

My personal M1 MBP that I got when it was first released still lasts over 10 hours. I code in VimR with Rust analyzer and compile Rust projects for hours on end. No issues.

Just, no Electron applications and stuff sips battery.

Mine gave me 10 hours easy. With electron slack and other apps. The trick is to kill all Intel apps which you can filter out. Once I do that it just keeps running and remains cold.
Any chance your IT/Infosec team has software running on your work machine? I've seen times when security software will chew up CPU when the machine is idle.

That said, my M1 has all sorts of gnarly IT/Infosec stuff running (banking industry) and even that doesn't seem to make a dent in my battery capacity (on top of using several Electron based apps all day long as well).

There's a ton of that sort of software, but with the upgrade to Ventura they dropped a whole range of them and really pared it down. Much of that stuff doesn't take up a whole lot of CPU anymore.
My anecdata: M1 MacBook Air, and I haven't noticed such a drastic difference in battery life in a day in Xcode vs. a day in Visual Studio Code. However, I run a very lean install of VS Code, plugin-wise, which certainly helps.

Overall I've found myself impressed with VS Code's efficiency and performance as an Electron app, especially versus Discord (gross) or Teams (awful).

When coding, you usually will have linter or compiler taking 100% core in the background.
Seems Electron for the win. I think upgrading to M2 MBP will help a bit until M3 pro is out. Lets be honest M1 MBP is dinosaur when it comes to modern dev tools like Slack or VSCode etc.
> Lets be honest M1 MBP is dinosaur when it comes to modern dev tools

That's amazing that you would come to this conclusion, rather than the tools are atrocious.

And that is why developers should shun Electron apps. The fact that every developer uses them is shameful. We should have more self respect to not use memory hogs and inefficient programs.
I work for many hours with IntelliJ/IDEA. 4 open browsers with 100+ tabs in total. Presentation and video software. The works.

Docker will sabotage performance and battery life.

The worst are x86 processes. Make sure to have only ARM processes.

My work machine is an M1 Pro, and there are days where I forget to plug it in and I still have maybe 33% capacity left at the end of the day.

I'm typically in VSCode, XCode, Slack, and Zoom, and have more Chrome tabs open than physics allows. Lots of software building, even the occasional AI image generating sessions, and the battery just keeps on keeping on.

Prior to this machine, my Intel MBP would have melted into a puddle after using its entire battery in 20 minutes.

I got a 2021 M1 MacBook Pro a few months ago. Battery life is better than on my previous 2012 MacBook Pro, but not as good as I'd expected. I don't do anything heavy on the computer—browser, Discord (which I know is Electron), Excel, and ssh—and the M1's battery only lasts for about six hours. Can using Chrome as the browser and not Safari make that much of a difference?
In my web dev work I use Chrome, Firefox, Safari, and Safari Tech Preview on a 2021 M1 MacBook Pro. My (anecdotal) experience is yes, Chrome eats M1 battery. This is true for Chromium as well, so Electron apps eat battery too. Some people have found significant battery life savings from avoiding Rosetta; maybe check if your Excel is running native Apple silicon or through Rosetta (iirc they very recently updated Excel for Mac to run native).
My Excel is indeed running natively, but I did find via Activity Monitor two other leftover things that are Intel that I should either get rid of, or update. I doubt they're the cause of any significant battery drain compared to Chrome (actually Edge now, but I doubt it's any better given the Chromium base), and I have other Intel software without Apple Silicon alternative, but it was still a useful thing to do.
Yeah the culprit is largely VSCode and electron/chromium apps. This why I personally switched into native apps for my dev work. Currently using Sublime Text and as much as possible I use tools like a site specific browser tool, Unite 4 to lower reliance on electron apps. Also I don't always have build systems on especially Docker and similar VMs