TL;DR: M1 machines are astonishingly fast! For iOS builds (with caching), we see build time improvements of ~50% compared with the Mac Pros.
In November 2020, Apple released the M1 MacBook and, one year later, the M1 Pro/Max chips. Since then, we have all read and heard from other people about the crazy performance improvements. Perhaps you have already read the tweet by Jameson Williams (a staff software engineer at Reddit):
We know that M1 machines are fast, but should we use them in CI/CD to speed up our pipeline? To help answer that question, we compared the M1 mini, Mac Pro, and Mac mini for iOS and macOS builds with Codemagic.
In this article, we’ll give you the facts and figures you need to decide if an upgrade is worth it.
Let’s talk about the setup of this comparison and take a look at questions like:
To compare the builds of the Flutter apps, we used two apps:
In comparison, we focus more on the Sharezone app because Sharezone is a real production app with +300,000 registered users. It uses a bunch of dependencies, like many of the Firebase packages and several other ones (Sharezone is open source — you can find all the dependencies here). Therefore, you will see very realistic build times.
We are focusing on the following:
We are using Codemagic’s virtual machines for the test, which you can use for CI/CD. These machines have the following configuration:
Flutter version that we used is 2.10.5
To get a more realistic view, all builds use the release mode of Flutter.
For the tests, we just used the flutter test
command.
We compared the builds without and with caching. For caching, we cached the following paths:
$FLUTTER_ROOT/.pub-cache
HOME/Library/Caches/CocoaPods
For more information on how to use caching in Codemagic, just take a look at the documentation on dependency caching.
We ran every build three times and calculated the average. For example, the later build time for the iOS Counter app is the average time of three builds.
In total, we ran 54 builds. You can also take a look at this spreadsheet, which shows all the raw data and links to the builds.
We are coming to the central part of this article: the results. You will see how big the difference is in terms of build time between the Counter and the Sharezone apps. Therefore, it’s essential to use a real app for comparisons like this.
All build times are measured in seconds.
Platform |
Mac mini |
Mac Pro |
M1 mini |
---|---|---|---|
iOS |
92 |
75 |
30 |
macOS |
89 |
51 |
25 |
Caching |
Mac mini |
Mac Pro |
M1 mini |
---|---|---|---|
No |
967 |
658 |
395 |
Yes |
892 |
598 |
281 |
The results are incredible! The M1 machines reduce build times (with caching) by 68% compared with the Mac mini and 53% compared with the Mac Pro.
Caching |
Mac mini |
Mac Pro |
M1 mini |
---|---|---|---|
No |
479 |
466 |
433 |
Yes |
501 |
401 |
333 |
On macOS, we don’t see as huge of improvements compared with the iOS builds, but the M1 builds (with caching) are still 34% faster than the Mac mini builds and 17% faster than the Mac Pro builds.
Mac mini |
Mac Pro |
M1 mini |
---|---|---|
84 |
90 |
95 |
When comparing the machines in terms of unit and widget tests, we see nearly no differences between them.
Sharezone has 238 unit and widget tests
To sum up the results: The M1 machines are nearly 50% faster than the Mac Pro machines, and their results are especially interesting when it comes to integration tests. We all know that slow CI pipelines suck.
However, not only will M1 machines reduce the build times of your integration tests, but they are also the way to go if you want to publish your apps on the App Store or Play Store.
Get started with Codemagic and M1 machines!
Also published here by Nils Reichardt, the co-founder of Sharezone.