Celebrating the release of Android Studio Electric Eel

Celebrating the release of Android Studio Electric Eel

How the update helps speed up our import times by 60%

Tucked away in the Android Studio Electric Eel release notes is a small announcement about a new parallel project import feature. For most Android app developers on small code bases, this change may not be significant. But for large mobile code bases, especially for ones used at Square, it represents a significant enhancement. For our apps that rely on more than 3,000 Gradle subprojects, we measured the average sync time reduced from 9 minutes to 3.5 minutes, a 60% average gain in performance. This improvement based on our calculations would translate to more than 1,600 hours saved in developer productivity per year!

image1

Average sync time (mins) comparison across IDE versions synced against 3000+ Gradle projects

The long sync times emerged as one of the top pain points by our developers over the past two years. They have often been forced to endure long wait times whenever they need to retrieve new code or switch branches that fundamentally change the structure of the build graph because of this sync process. Furthermore, as the total number of Gradle subprojects grew from 1,800 to 4,400 modules, a 130% increase over the last two years, the sync times more than doubled as well, contributing more consternation of lost productivity.

In October 2020, we learned that Gradle and Google were also focused on solving this vexing problem. As Google began preparing fundamental changes needed to remove the bottleneck of a single-threaded process responsible for the sync mechanism and Gradle released APIs that enabled parallel model building, we prioritized being ready to leverage new versions of Android Gradle Plugin (AGP) that would allow us to take advantage of these improvements. The herculean task of revamping our 60,000 lines of mission-critical build logic code, which often relied on rapidly evolving APIs of AGP that had little to no test coverage, is described in an earlier blog post by Tony Robalik.

We also played an active role in ensuring this successful release. Tony Robalik and Paul Hundal built an internal tool to enable our developers to evaluate different canary versions of Android Studio, automating an arduous setup process needed to configure the IDE to work with our code base. Thanks to the open source nature of Android, Pierre-Yves Ricau identified a critical memory leak in early preview versions of Electric Eel that prevented our entire code repository to sync, and Pablo Baxter submitted a patch to address the issue. Michael Yoon built an entire Continuous Integration (CI) pipeline to measure the performance characteristics of more than 72+ permutations of Kotlin, AGP, Gradle, and IDE versions that gave us early confidence these improvements would work in our code base using the Gradle Profiler open source tool with a few additional patches (1, 2) from Gradle to benchmark the newer IDE versions. We also internally tested and advocated for an important fix to be incorporated into the third release candidate of Electric Eel after more than 40 of our developers found it critical for resolving a lot of the freezing problems that they were experiencing.

image2

Example of our internal benchmarks measuring sync times

Making the IDE work well in our Android codebase has always been the last mile of improving the developer experience. The difficulty has always resided in untangling the complex interaction of tools and plugins maintained by JetBrains, Google, and Gradle. We're grateful to our industry partners for their collaboration and support, and we're here to celebrate this major milestone with them!

View More Articles ›