DEV Community

Cover image for Apple Silicon chip performance in Android development
Pavel Sveda
Pavel Sveda

Posted on

Apple Silicon chip performance in Android development

After many years when Intel and AMD dominate the world of workstation CPUs with x86 chips there seems a new era to come. The era of ARM.

Apple has introduced its ARM-based Apple Silicon M1 chip in late 2020 and the first benchmarks were for a lot of people too good to be true.

Motivation

I'm an Android developer so what bothers me most is how performant is the chip in Android development.

Official benchmarks are great to get some overview about CPU capabilities but they cannot answer my question as they are mostly based on rendering video or running demanding games which is a different kind of task.
Also it would not be fair to do the comparison right away at the end of 2020 as the Android ecosystem was not compatible with Apple Silicon chips natively and the tools were running through the Rosetta 2 application compatibility layer.

Now, after a few months since Apple Silicon launch there are first OpenJDK builds with native support and Gradle supports it natively since version 7.0. That's all we need to make an Android project build times comparison!

Test

We have 4 competitors in the test:

  • 2019 Dell Precision 5530, i7-8850H, 6 cores/12 threads, 32 GB RAM
  • 2020 MacBook Pro 16", i7-9750H, 6 cores/12 threads, 16 GB RAM
  • 2021 MacBook Pro 13", M1, 8 cores/8 threads, 16 GB RAM
  • 2021 MacMini, M1, 8 cores/8 threads, 16 GB RAM

The test is to be done on 3 selected Android projects:

  • Small project (13k LoC, 1 APK, 1 module)
  • Medium project (37k LoC, 1 APK, 36 modules)
  • Bigger project (144k LoC, 6 APKs, 30 modules)

To compare the build times, I would first run the gradlew assembleDebug to warm up the Gradle daemon and fetch all the dependencies and then make an average build time from 5-10 runs of the same task in offline without any help of cached results:
gradlew assembleDebug --offline --rerun-tasks --profile

Main questions to ask are:

  1. Will MacBook Pro 13" with M1 chip beat the bigger Intel-based brother?
  2. Will MacMini beat the MacBook Pro 13" with the same HW equipment thanks to its desktop nature and possible more power or better cooling?
  3. Will 8 cores be enough for modularized projects?
  4. Will 16 GB of RAM be enough even for bigger projects?

Results

Here are the average build times for competitors on the test projects. Some were run both with Gradle 7.0 with native Apple Silicon support and Gradle 6.8 that uses Rosetta 2 compatibility layer.

Alt TextSmall, single-module project cannot be parallelized much but the M1 chip did the job in half the time then Intel i7 chip in MacBook Pro 16".
Gradle 7.0 with native Apple Silicon support is certainly faster than Gradle 6.8 that uses Rosetta 2, but the difference is almost negligible.

Alt TextSimilar results are to be seen on medium and well modularized project. Dell's and Mac's 12 threads Intel i7 chip were still too slow against M1.

Alt TextOn bigger project the difference in speed isn't so enormous but still the M1 outclassed the rivals. In this run the MacBook Pro 16" did a worse job than the technically slower Dell Precision probably due to smaller RAM.

Answers

I leave the results evaluation on each of you but let me just try to answer the main questions:

1. Will MacBook Pro 13" with M1 chip beat the bigger Intel-based brother?
Yes, no doubt about it!

2. Will MacMini beat the MacBook Pro 13" with the same HW equipment thanks to its desktop nature and possible more power or better cooling?
No, this test didn't show any difference in performance of those two. Maybe when an IDE and Emulator will be running for 8 hours a day the MacMini might be more stable but that would be a more subjective observation.

3. Will 8 cores be enough for modularized projects?
Yes, the difference in performance on single-module and highly modularized project were similar.

4. Will 16 GB of RAM be enough even for bigger projects?
Yes-ish. Macs with M1 chip were fine with 16 GB RAM during the test but the older MacBook Pro 16" seems to have a problem on the bigger project. Also, IDE and Emulator were off during the test so in real-world use it might be a little limiting. One way or another, the power of M1 would overcome this limitation.

Main article image by Jason Corey on Unsplash.

Discussion (0)