Benchmark real Android projects on modern MacBooks

If you’re interested in Android development, you’ve most likely heard of Telegram channel “Android Broadcast” with daily news for android developers and YouTube channel of the same name. This post is the text version video.

The choice of technology is always a difficult task, and the new Apple processors were able to shake up the market and complicate the choice. Which MacBook model to choose, and how much one is better than the other, is difficult to understand. Looking for quality tests is still fun.

In this article, I will correct comparing the build speed of real Android projects on various MacBooks, and also recommend which one to choose in early 2022.

Comparison computers

For comparison, I chose the latest MacBook Pro on Intel, as well as modern MacBooks based on the M1. I also added my old iMac 27″ Late 2015 to visually see the progress from the update.

  1. iMac 27″ Late 2015 Intel Core i7 6700K | 24GM RAM

  2. MacBook Pro 16″ 2019 i7 9750H 6 CPU/12 Threads | 16 GB RAM

  3. MacBook Pro 16″ 2019 i9 9880H 8 CPU/16 Threads | 32 GB RAM

  4. MacBook Air 2020 M1 | 16 GB RAM

  5. MacBook Pro 14″ 2021 M1 Pro 8 CPU | 16 GB RAM

  6. MacBook Pro 14″ 2021 M1 Pro 10 CPU | 32 GB RAM

  7. MacBook Pro 16″ 2021 M1 Pro 10 CPU | 32 GB RAM

  8. MacBook Pro 16″ M1 Max | 32 GB RAM

Test Methodology

It is not easy to provide completely equal conditions for all computers, but I tried to create ideal conditions:

  • Use JDK 11 and update it to the latest revision.

  • Use Gradle 7.3.3 to build the project.

  • Disable external displays.

  • Connect the computer to power.

  • To the maximum, close all programs, including background ones.

  • Close Android Studio!

  • Enable performance mode in settings (if available).

  • Put the laptop on a flat, hard surface so that there are no problems with air intake and cooling.

  • Do not touch the computer during the test.

  • Disable Spotlight indexing or add a folder with projects for tests to exceptions.

If you know any additional conditions that should be observed when conducting a benchmark, I will be glad to read them in the comments to the article.

The tests were carried out using the utility Gradle Profiler in benchmark mode, designed to measure the speed of building projects. The result was the average of ten test runs – after two assemblies for warming up, which did not count.

For each project, a script was created to run the test (file performance.scenarios), and all projects are collected in a separate repositories.

Tests

Specific figures are shown in the table below.

TiVi 0.6.3

TiVi Github

TiVi – a small project to track the progress of a TV show based on trakt.tv.

Technology stack: Jetpack Compose, kapt, Kotlin, Dagger, Hilt, Android Arhitecture Components, Firebase, Google Services, etc.
Number of lines of Kotlin code: 15 422
Connected Gradle plugins: Android, Kotlin, Crashlytics, Hilt, Google Services, Kotlin Extentions, Spotless, Gradle Depedency Updates
Number of modules: 25

The project is small, but even here Intel is far behind the M1. The M1 Pro/Max was only one second ahead of the M1. One thing is clear from the test results: even on such a small project, it is already clear that Apple Sillicone is much faster than the 9th generation Intel Core.

TiVi build speed 0.6.3
TiVi build speed 0.6.3

ExoPlayer r.2.16.1

ExoPlayer is a popular media player that is used at the Android application level.

Number of lines of Java code: 224 638
Number of modules: 35

The following project demonstrates the advantage of multiple performance cores in the M1 Pro/Max. There was a significant lead as a result: M1 coped in 39.4 seconds, and M1 Pro / Max with 10 cores – in 28 seconds. The best Intel did it in 43.9 seconds.

ExoPlayer r2.16.1 build speed
ExoPlayer r2.16.1 build speed

Focus 95.2.0

Focus is a special private and secure version of the Firefox web browser.

Number of lines of Kotlin code: 19 066
Number of XML lines: ~30 thousand
Number of modules: 3

The Focus benchmark shows patterns already identified, but shows that the octa-core version of the M1 Pro isn’t far behind the full M1 Pro or M1 Max.

Firefox Focus 95.2.0 build speed
Firefox Focus 95.2.0 build speed

Firefox 95.2.0

Firefox is the full version of the Firefox web browser.

Number of lines of Kotlin code: ~97k
Number of XML lines: ~100 thousand
Number of modules: 4

Compilation speed of Kotlin code is an order of magnitude lower than Java. However, Apple processors show a natural acceleration of compilation. That’s just the difference between the M1 Pro with 8 and 10 CPU cores is still invisible. How so?

Firefox 95.2.0 build speed
Firefox 95.2.0 build speed

Signal 5.28.8

Signal is a popular messenger, an alternative to Telegram.

Number of lines of Java code: 248 305
Number of lines of Kotlin code: 42 476
Number of XML lines: ~270 thousand
Number of modules: thirteen

Finally, it can be seen that the 8 cores of the M1 Pro are slower than the full version of the processor. The rest is just a confirmation of the conclusions obtained in previous projects.

Signal Android 5.28.8 Build Speed
Signal Android 5.28.8 Build Speed

Telegram 8.2.1

Telegram Android GitHub is a popular messenger. The project is written in a rather specific way: no Kotlin, all UI in Java code, no code generation with apt or kapt, NDK is used.

Number of lines of Java code: 700 098
Number of lines of C code: 988 320
Number of XML lines: ~40 thousand
Number of modules: one

Telegram Android is the largest of the tested projects and clearly shows the difference between processors. Benchmark surprised: this is the only project in the tested, in which the i7 and i9 in the 2019 MacBook Pro were able to build the project faster than the Apple M1. Of course, I was wondering why it happened, and I climbed to understand.

Telegram Android 8.2.1 build speed
Telegram Android 8.2.1 build speed

The reason turned out to be CMake and all the tooling for compiling native code, which is enough in Telegram. On Apple M1 compilation starts c using Rosetta 2 – in Android NDK, at the time of this writing, they had not yet managed to transfer it to Apple Silicone support. Although CMake, starting from version 3.19, and other tools already have this support. Details here.

It turns out that in the future we will get a significant boost: at least the Apple M1 has a chance to overtake the i7 and, what the hell is not joking, even the i9. So we are waiting for the tooling to be finished.


Application build results.  Less is better
Application build results. Less is better

Conclusions from the tests

It’s too early to write off Intel Core if the project has a lot of native code. In all other scenarios, there is no point in Intel processors: they lose even to the most basic Apple M1. Over time, tooling will be finished, and the advantages of Apple processors will become even more obvious.

The MacBook Air on M1 will suit most mobile developers. I only advise you to take the option with 16 GB of RAM. With it, you can develop for Android and iOS, as well as try multi-platform development (Kotlin Multiplatform, Flutter). A big advantage is the absence of coolers, which makes it quiet, but sometimes hot (with a very long assembly).

If you work with large projects and want to get the most out of it, or you need more than 16 GB of RAM, then I recommend paying attention to the MacBook Pro with the M1 Pro processor in a 10-core variation. The 16″ version will be faster and quieter.

M1 Max and M1 Pro showed no significant difference in results. The Max version is worth taking for development only if you need 64 GB of memory. You only need to buy it in a 16-inch case: in the 14-inch version, the GPU has lower frequencies, and the processor will start throttling faster due to heating and making more noise. Don’t forget that the battery size is smaller in the 14-inch version: the battery life even without complex tasks will be less compared to the 16-inch version.

Comparison with Ryzen and Intel 12th generation

I want to continue the comparison and evaluate the compilation speed on modern processors from AMD and Intel, but so far there is no way to do this. I will be glad if you join the test by filling out form. I already managed to run tests on the Ryzen 5900X, and its speed was impressive, but this is a topic for a separate article…

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *