Live data from Hacker News

How M1 Macs feel faster than Intel models: it’s about QoS

eclecticlight.co

91–100 of 427 posts

Re: How M1 Macs feel faster than Intel models: it’s about QoS

#91
post #75

It does not just feel faster, in many cases it is faster. E.g. compiling Rust code is so much faster that it is not even funny. cargo install -f ripgrep takes 22 seconds on a Mac Book Air with M1, same on a hexacore 2020 Dell XPS 17 with 64GB RAM takes 34 seconds.

In native Typescript compile of a very large angular app I see an even more dramatic 1:20s to 40s compared to a desktop i9. I feel as if the M1 may have been designed around a detailed and careful look at how computers and compliers work and then designed a CPU around that rather than the other way around.

It's like buying a car and modifying to take it racing vs buying a race car, the race car was designed to do this.

Re: How M1 Macs feel faster than Intel models: it’s about QoS

#93

This certainly makes a lot of sense, and it's a brilliant strategy to improve overall performance. But it doesn't account for the full picture either. My M1 Macbook Pro feels about as responsive as my desktop system with an AMD Ryzen 3900X, which is impressive to say the least. It doesn't quite have the raw computing power of the 3900X, but given that it's a portable device that's something else.

Try a low latency kernel on your desktop if you use Linux, that should improve responsiveness some more. Apparently the increase in power consumption is minimal - I use (K)Ubuntu's low-latency kernel even on laptops these days.

You can also do some "nice"-level management. My XMonad environment is simpler than most, so it's easier for me than someone running a full desktop environment with dozens of processes running around, but I got a lot of responsiveness improvements by nice-ing and ionice-ing my browser down in priority. It does mean that occasionally I switch back to it and it hiccups, but on the flip side it has stopped consuming so many resources and everything else feels much more responsive.

I'm actually not sure why it has the effect it does, entirely, because at least in terms of raw resource use the browser doesn't seem to be eating that much stuff, but the effect in practice has been well beyond what can be explained by perceptual placebo. (Maybe there's too many things competing to get the processor at the VBlank interval or something? Numerically, long before the CPUs are at 100% they act contended, even in my rather simple setup here.)

Or, to perhaps put it another way, Linux already has this sort of prioritization built in, and it works (though it's obviously not identical since we don't have split cores like that), but it seems underutilized. It's split into at least two parts, the CPU nice and the IO nice. CPU nice-ing can happen somewhat automatically with some heuristics on a process over time, but doing some management of ionice can help too, and in my experience, ionice is very effective. You can do something like a full-text index on the "idle" nice level and the rest of the system acts like it's hardly even happening, even on a spinning-rust hard drive (which is pretty impressive).

Re: How M1 Macs feel faster than Intel models: it’s about QoS

#94
post #75

It does not just feel faster, in many cases it is faster. E.g. compiling Rust code is so much faster that it is not even funny. cargo install -f ripgrep takes 22 seconds on a Mac Book Air with M1, same on a hexacore 2020 Dell XPS 17 with 64GB RAM takes 34 seconds.

Are you counting download time as well? It took 8.30 sec on hexacore now when I tried it.

Re: How M1 Macs feel faster than Intel models: it’s about QoS

#95
post #36

Earlier quoted context omitted.

What workloads do you run? I’ve got a 16GiB M1 mbp and a 2019 maxed intel and when compiling Java/sbt projects the intel is significantly quicker, albeit also much loader and power hungry.

As the sibling comment mentions, if you're running Intel JDK on M1 it will be slow. You can find M1 native JDK builds here: https://www.azul.com/downloads/?version=java-11-lts&os=macos...

Just for fun, Oracle has also started providing natively compiled EA builds of JDK 17: https://jdk.java.net/17/

Re: How M1 Macs feel faster than Intel models: it’s about QoS

#96
post #36

Earlier quoted context omitted.

What workloads do you run? I’ve got a 16GiB M1 mbp and a 2019 maxed intel and when compiling Java/sbt projects the intel is significantly quicker, albeit also much loader and power hungry.

That compiler most probably not native to m1 arm processor.

Indeed, I was using the GraalVM jdk11 build which wasn’t available in a native version indeed.

Re: How M1 Macs feel faster than Intel models: it’s about QoS

#97

Earlier quoted context omitted.

> when compiling Java/sbt projects Are you comparing a binary being run under dynamic binary translation with a native binary? Not really an honest comparison, if that's the case.

No idea if that's the case, but I wouldn't have expected Java of all things to be run under binary translation.

You have to install a Java VM compiled for ARM such as the one made by Azul. If you just get the openjdk from the main website it is compiled for Intel and will be much slower.

Re: How M1 Macs feel faster than Intel models: it’s about QoS

#98

Earlier quoted context omitted.

Try a low latency kernel on your desktop if you use Linux, that should improve responsiveness some more. Apparently the increase in power consumption is minimal - I use (K)Ubuntu's low-latency kernel even on laptops these days.

I run KUbuntu, how can I enable this? EDIT: I searched a bit and, although I haven't found instructions anywhere, I did find people saying that the low-latency kernel decreases throughput as a tradeoff to lower latency. Have you found this to be the case? Also, another source says that the preempt kernel might be better for some workloads: https://itectec.com/ubuntu/ubuntu-choose-a-low-latency-kerne... Can anyone com…

I have not tried the preempt kernel. I have tried the lowlatency kernel and found that it improved overall performance, not just latency.

Turns out that the cost of NUMA balancing (https://www.kernel.org/doc/Documentation/sysctl/kernel.txt) was outweighing any benefit we might get from it. The problem is that NUMA balancing is implemented by periodically unmapping pages, triggering a page fault if the page is accessed later. This lets the kernel move the page to the NUMA node that is accessing the memory. The page fault is not free, however; it has a measurable cost, and happens even for processes that have never migrated to another core. The lowlatency kernel turns off NUMA balancing by default.

Instead of switching to the lowlatency kernel, we set `kernel.numa_balancing = 0` in `sysctl.conf` and accepted the consequences.

Re: How M1 Macs feel faster than Intel models: it’s about QoS

#99
post #28

This certainly makes a lot of sense, and it's a brilliant strategy to improve overall performance. But it doesn't account for the full picture either. My M1 Macbook Pro feels about as responsive as my desktop system with an AMD Ryzen 3900X, which is impressive to say the least. It doesn't quite have the raw computing power of the 3900X, but given that it's a portable device that's something else.

Well, they did it first in iOS which is more responsive than Android even when compared to devices that win benchmarks vs the iPhone. It's just doable when you care enough to optimize the OS for responsiveness.

Much like the M1, I don't think anything actually wins benchmarks vs the iPhone. There's display refresh rate and a few multicore stores that are closer but in any real world test, Single core dominance wins out. (Plus the big/little design in the A series chips is better than the three scales seen in QC chips as QC backfills the single large core with a ton of little cores to make the multicore numbers look competitive when in reality, any multithreaded task of two cores is much faster and you don't end up with mismatched race conditions.)
Post reply on HN