The new Apple M1 processor has gotten excellent reviews for speed. Getting curious, I measured its speed on pure c code, latex and R and compared it to its most recent Intel competitors.
The c code I ran my PhD thesis on still compiles and runs, three decades later. I’ve tried it on a number of computers, operating systems and c compilers and it always works.
That makes it a nice benchmark for new computers.
My main computer is a year old MacBookPro 16 with its fastest processor, and my travel laptop is a two-year-old MacBookAir. I just got the new ARM-based MacBookAir M1. Every review I’ve seen says it is blazingly fast, so I tried it on my old c code, and here is what happened.
I also tried to compile latex slides, always a slow process. These are the slides I tried.
In the below, Rosetta means the intel emulation on the M1.
|MacBookAir||Intel i5-8210Y CPU @ 1.60GHz||6.98 seconds|
|MacBookPro||Intel i9-9980HK CPU @ 2.40GHz||5.86 seconds|
|MacBookAir M1 rosetta||Apple M1||7.14 seconds|
|MacBookAir M1 native||Apple M1||5.42 seconds|
For the M1, I tried both the Intel compiled code, run under the Rosetta translation, and a native compilation.
So, the M1 under Rosetta is much slower than its Intel predecessor, but the native M1 code handsomely beats the three times more expensive MacBookPro.
|MacBookAir||Intel i5-8210Y CPU @ 1.60GHz||49.20 seconds|
|MacBookPro||Intel i9-9980HK CPU @ 2.40GHz||31.00 seconds|
|MacBookAir M1 rosetta||Apple M1||26.86 seconds|
Latex does not have a native M1 release.
I did not expect that. The MacBook air running Intel compiled latex distribution beats the fastest and most expensive MacBookPro.
I finally tried a small R application, a GARCH optimization similar to what I did here.
|MacBookAir||Intel i5-8210Y CPU @ 1.60GHz||0.434 seconds|
|MacBookPro||Intel i9-9980HK CPU @ 2.40GHz||0.333 seconds|
|MacBookAir M1 rosetta||Apple M1||0.462 seconds|
|MacBookAir M1 native||Apple M1||0.216 seconds|
The native M1 is running R Under development (unstable) (2021-02-06 r79953)
If I had seen this anywhere else, I would not have believed it. The M1 is a third faster than the intel MacBookPro.
Merits more investigation, and consistent with the c results. I am so far impressed!
One caveat, this M1 version of R is unstable, and most packages I tried don’t work yet.
There should be no surprises in these results, they correspond with what other people have found. But the sceptic that I am, I had to see for myself. I did not expect the ARM to be a third faster than the top of the line Intel.
Once lockdown is over, I will compare it to the brand new and fastest single core Intel Mac on the market, now sitting unused in my office, (a 3.6GHz 10-core 10th-generation Intel Core i9 processor). I’d be curious to see if it beats the MacBookAir M1 on single core apps.
There are caveats. My test is only on a single core. It is only testing raw CPU speed in numerical calculations. And then, the numerical calculations I am doing. The latex is heavily dependent on disk speed, and R is specific to what I do. In other applications it will look different.
The Intel MacBookAir looks better than it deserves. It is a slow machine, very slow, and just unpleasant to use.
I am looking forward to native M1 versions my main applications. R is here now, but only in beta. Latex is not. Python sort of, but yet missing packages I need, like scipi. Latex and Julia not yet.
My job market paper with the application I am running the c code from is:
Danielsson, Jon, 1994, “Stochastic Volatility in Asset Prices: Estimation with Simulated Maximum Likelihood”, Journal of Econometrics.
And the algorithm I developed in my thesis with my PhD advisor for fast integration of latent variables from the stochastic volatility model was published as
Danielsson, Jon and Jean-François Richard (1993) “Accelerated Gaussian Importance Sampler with Application to Dynamic Latent Variable Models,” Journal of Applied Econometrics.
© All rights reserved, Jon Danielsson, 2021