The Apple M1 compiles Linux 30% faster than my Intel i9

(With a caveat: I'm compiling the ARMv8 64-bit Pi OS kernel.)

It seems every week or so on Hacker News, a story hits the front page showing some new benchmark and how one of the new M1-based Macs matches or beats the higher-priced competition in some specific benchmark—be it GeekBench, X86-specific code, or building Emacs.

Well, here's my quick story.

I've been doing a lot of work with Raspberry Pis lately—more specifically, work which often requires recompiling the Pi OS Linux kernel for the aarch64 architecture. I recompile the kernel enough I made my own shirt for it!

Linux shirt from Red Shirt Jeff.com - It has been 0 days since I recompiled the Linux kernel

With this Docker-based environment on my 2019 Intel i9 16" MacBook Pro, I can compile the kernel from scratch in about 12 minutes.

The Intel laptop cost over $3000 when I bought it, and the thing is basically a frying pan on my legs and has two obnoxiously-loud fans running full blast whenever you even look at it sideways.

I bought both an M1 10 Gbps Mac mini and a M1 MacBook Air to replace the 16" Pro—for the same total price—and I ran the same compile on it, using the exact same configuration.

Total time for the test was 9 minutes on the mini (which has a fan to keep the CPU cool under load) and 10 minutes on the Air (which doesn't have a fan, so it starts to throttle after a while).

M1 vs i9 Linux Kernel Recompile for Raspberry Pi OS

And even if the mini's fan came on during the build (it probably did), I couldn't even hear it over the ambient 32dB environment in my office. The Air was blissfully silent.

That's not fair!

Yeah, well, it's one of the things that takes the most time and makes an impact on my own workflow. I know that cross-compiling Linux on an Intel X86 CPU might not be as fast as compiling on an ARM64-native M1... but that's not the point.

This is a very real benchmark that impacts my ability to get work done. And it's faster on even the cheapest low-end M1 Mac. And the fans are silent (or nonexistent), and the heat output and energy consumption is minimal.

I mean heck, the power supply for the i9 MacBook Pro is comically large compared to the Air's supply:

M1 MacBook Air vs Intel 2019 i9 16 inch MacBook Pro USB-C Power Adapter

And even the 96W adapter is smaller than most PC laptop PSUs I've used, especially for the type of 'luggable desktop' machine commenters will, I'm sure, point out, which could destroy my M1s with more cores (and more power consumption and heat)!

What matters?

In the end, I'm happy with my decision—overall. The M1 platform definitely has some growing pains.

For example, my mini has weird issues on both HDMI and DisplayPort connections so far:

  • If using HDMI to my LG 4K display at 60 Hz, the display just blanks out entirely for 2-4 seconds every 5 minutes or so. No clue why.
  • If using DisplayPort through a CalDigit TS3 Plus dock, the display works great, but when I put the mini to sleep, or the display shuts off, the LG display keeps restarting itself every 10 seconds or so, which is highly annoying.

What matters most to me, though, is the fact that I can do my work faster, with less energy use, way longer battery life, and all without burning my legs every time I use my laptop on my lap.

I was questioning whether I'd still use an Apple laptop after my bad experiences with both the Touch Bar and non-Touch Bar 2016 MacBook Pro, and the 2019 MacBook Pro had just enough charm to keep me running macOS daily. But if these first-generation M1 Macs are anything to go by, I think I'm going to be a happy macOS user for a while longer.

Now, if only Apple and Raspberry Pi could partner up and build an SBC with the M1...

Comments

Do you have a recommendation for virtualizing ARM Linux VM with vagrant support on M1 Macs?

So far I'm just using Docker for my VM needs, but I would like to find a good solution that's more full-featured like VirtualBox was, and not just a containerization wrapper.

> If using HDMI to my LG 4K display at 60 Hz, the display just blanks out entirely for 2-4 seconds every 5 minutes or so. No clue why.

FWIW, this happens to me on my Intel MacBook + 4k display often as well.

I had a lot of issues with my old "apple distributed" LG monitor. I traded it out for a newer model LG and all of my mac compatibility issues and non-wake issues went away.

On the latest ATP podcast episode, they talked about something with an Apple TV trying to push 4k@60hz through to a TV via an HDMI cable, and described a situation which sounded exactly like that.
Their resolution was that the actual HDMI cable was too old/underspecced, and a newer higher-grade cable resolved it perfectly. Perhaps this may be helpful?

It's possible one of my cables is flaky—I've had bad HDMI cables in the past that work great for 1080p but fall apart at 4K. In this case it was a known working cable (used on my MacBook Pro without issue), so I'm next going to try to use a USB-C to DisplayPort cable connected directly through one of the USB4 ports on the back of the mini.

I had this same issue with my Apple TV 4k and a low quality/old HDMI cable was to blame. I swapped it with my PC monitors unused HDMI cable and and no more screen blinking issues. This is likely the issue you are seeing with your monitor and an actual quality cable will resolve this issue.

I get a feeling that, to have a “server like” docker environment of the future, that docker environment will need to be ARM based, anyway. Cloud servers will mostly go that way, I reckon.
Intel machines will be doing a lot of cross-compiling soon…

This was what ultimately led me to decided to ditch the i9 before hearing whatever comes out at WWDC; I do a ton of ARM stuff anyways, and this will let me also switch some projects more easily to AWS Graviton servers, which are slightly cheaper for the same performance.

Yeah M1 R-Pi... it would kill Apple's entire business model. Cheap system running reasonably useful, user controlled, private OS more powerful than any of the competition? The Foundation couldn't keep them coming fast enough. I wouldn't shed a tear for neither Apple nor Intel. AMD might be able to pivot fast enough to keep up.

I happen to feel your irritation with the display issue on the Mini. I have a gripe of my own for the M1 MBP. I have a LG 4k HDR-10 monitor I originally got to compliment my MBP but has ended up on my main Windows desktop. No matter what I do I get screen flickering either via USB-C to DP or USB-C to HDMI. Some people make excuses for it, and say it doesn't matter to them. I can't stand it in the least, it breaks concentration, ruins movies, etc. There's no way to fix it. Windows? No big deal, no flickering, same monitor settings. MacOS has some compatibility issues for sure. Not everything "just works".

The annoying thing is, I get perfect behavior (60 Hz, no flicker, no sudden dropouts) using Mac -> CalDigit -> DisplayPort -> LG monitor, but when it sleeps or when the Mac turns off the display, it does that weird on/off loop until the display is woken up again.

Neither my outgoing i9 MacBook Pro or even the 13" M1 Air exhibits the same behavior. Something must be funky with the M1 mini :(

I did just upgrade to 11.4 today; we'll see if that makes a difference.

> cross-compiling Linux on an Intel X86 CPU isn't necessarily going to be as fast as compiling on an ARM64-native M1 to begin with

Why would this be the case?

Eh... I should probably be more careful with that statement—there are some things (which I'm not sure are present in the Linux kernel—tbh I'm not that deep into compiler use to say anything intelligent there) that can be slower cross-compiling.

One thing I’ve noticed is that you seem to be running the x86 Docker images in both scenarios, at least from first glance. You also seem to make note of this in your linked issue.

Have you tried any testing of an aarch64 Debian image for your builds? I’m curious if there would be any notable performance differences doing native virtualization vs virtualizing a different architecture.

Did you find a solution to the issues when running the DisplayPort through a CalDigit TS3 Plus dock?
I'm having the same trouble, my work around so far is a USB-C to HDMI adaptor out of the TS3 to the screen, but I'd rather not have to have another adaptor/special cable...

Regarding the HDMI display blank, this happened to me as well - replacing the cable fixed it for me. Apparently there are higher quality cables needed.

My M1 Mini had the display blanking issue also, with my Samsung 49" 4K TV/Monitor.

But, it went away. I'm not sure what - maybe a MacOS update.

But I do have a big gripe with the M1 - a big enough issue I probably wouldn't have bought the M1 had I known: lack of 386 virtual machine support. And, VMWare has said it is not worth it for them to develop one (yes, it is possible - VM's have been around since 1967).

So all of my annoying EE and radio programs which run only on Wintel will now have to find a new home. And, some of my development tools are not running on the M1, even though they are portable. One, provided by embedded processor giant Microchip, will not be supported on the M1, per their response to my trouble ticket.

So Apple has made a really powerful device for what may be a dwindling market. In my opinion, they should have either developed their own x86 Virtual Machine, or strongly encouraged someone - such as VMWare - to do it for them. Not doing so is a finger in the eye to those of us who were happy with a Mac, and happy that we didn't need a Windoze machine for work that still had to be done on Windows.

Just to add to display related observations that have been said here, cables do make a difference.

I have plenty of cables that will handle 1080p60 all day long but some of those same ones either don't work for 4K60, have sparklies or have constant signal drops, especially on the longer HDMI cables. The Gbps bandwidth required for 4K60 is that much higher even when compared to 4K30, especially if you're expecting it to carry sound. It can be device specific too - what might carry 4K60 with an Xbox One X might fall apart on a PC or Mac desktop, seen that happen before.

Getting proper certified 4K60 capable HDMI2 cables or testing all your existing ones is the way to go. For my 2017 MacBook Pro i7 I use one of the left hand Thunderbolt ports with a USB-C shape to DP type cable (not one of those USB-A dongles which have a HDMI on the end, because again, bandwidth issues, just an end-to-end cable) and it'll drive a 4K60 monitor fairly consistently although sometimes when waking from sleep the MacBook gets "confused" and may drive the screen at 4K30 with jerky scrolling even though the monitor reports 60hz. Removing and replacing the cable usually fixes it, or a quick tinkering in Display settings.

> Now, if only Apple and Raspberry Pi could partner up and build an SBC with the M1...

The M1 Mini already *is* an SBC. CPU, RAM, SSD, networking, GPU, et al. are all soldered on a single board. Single Board Computer. Typically uses less than 10W.

This is due to thermal throttling - Apple intentionally gimped their Intel models, in part because the Macbook's coolant is entirely unacceptable, and in part because they probably wanted to ensure a large gap between the older Intel models and their newer M1 to spur more M1 model purchases.

Add to that the fact the i9 in the Macbooks only had a TJunction of ~80C and was gimped via thermal throttoe as a mobile chip (NOT a desktop chip) so this benchmark is essentially useless.

It's like beating the crap out of a horse, putting it in a race with other horses and pointing out how fast the other horses are.

So no. The M1 is not 30% faster than an i9, in ANY regard. The M1 is 30% faster than what Apple considers an "Intel i9".

Your guys are using laptop for cross compiling! That's not the best choice.
You'll easily reach lower than 6 minutes with a desktop high core count processor starting with 16/32 SMT ... paired with a minimum 5G/s NVME m2 storage

I remember Jeff referencing LTT in one of his videos, so this might be nothing new:
Did you know that Apple actually insulates the M1 chip inside the MacBook Air from the chassis to meet regulations on laptop surface temperature?
That means that if you're fine with slightly more heat on your lap, then you can replace an insulating pad inside the MacBook with a thermal pad, which gives the M1 chip more thermal mass to dump heat into and in turn, more performance.

If you really care about your work and time, why not use a workstation?! It compiles a Linux kernel in about 1min here. Recompiles with some changes take about 10s.
10min was like 15 years ago...
llamacc might also be interesting, makes it possible to compile full llvm in 90s through Amazon lambda.

Jeff,

I've had good luck running two LG 27UK670/BK67U 4K monitors at full resolution and 60Hz off of my M1 Mini. These monitors use the HDMI and one USB-C port for video out on the M1 Mini, no docks or hubs involved. In fact, these monitors have dual HDMI inputs, native DisplayPort input, and USB-C input for video while providing power over USB-C for something like laptop as well as dual USB 3.1 ports for peripherals.

These monitors seem to pair up nicely with the M1 Mini, and I've had zero issues with them going in and out of sleep mode. I picked both of these up at a MicroCenter for a pretty great price compared to what Apple wants to charge for their larger monitors.

Are you still happy with Mac now they will implement state surveillance on all Mac devices ?

> The Air was blissfully silent.

Well, the MacBook Air with M1 has no cooling fan.

Now, if only Apple and Raspberry Pi could partner up and build a *low cost* SBC with the M1...