Context. Android developers that developed Android apps using Java 6 for a long time got introduced to Kotlin as a new programming language in 2017. Kotlin contains many features that make it a popular alternative to Java in Android development, and together with the full support of Google and its creator, Jetbrains, it is becoming an essential part of Android development. Goal. This study aims to empirically assess the impact of the migration from Java to Kotlin on the run-time efficiency of Android apps. Methodology. To achieve this goal, we mine 7,972 GitHub repositories of Android apps and identified 451 apps containing Kotlin code. Then, by applying a crosslanguage clone detection technique, we detect 62 commits that represent a full migration to Kotlin, while keeping the app functionally equivalent. We sample 10 apps that fully migrated to Kotlin and conducted a measurement-based experiment to compare their Java and Kotlin versions with respect to seven runtime efficiency metrics. Results. Our study shows that migrating to Kotlin has a statistically significant impact on CPU usage, memory usage, and render duration of frames (though with a negligible effect size), whereas it does not impact significantly the number of calls to the garbage collector, the number of delayed frames, app size, and energy consumption. Conclusions. This study provides evidence that developers can migrate their Android apps to Kotlin and expect comparable efficiency at runtime. As a side product, this study also confirms that most open-source Android apps either fully migrated to Kotlin (>90% Kotlin code) or contain low portions of Kotlin code (<10%).
How does Migrating to Kotlin Impact the Run-time Efficiency of Android Apps?
Scoccia, Gian Luca;
2021-01-01
Abstract
Context. Android developers that developed Android apps using Java 6 for a long time got introduced to Kotlin as a new programming language in 2017. Kotlin contains many features that make it a popular alternative to Java in Android development, and together with the full support of Google and its creator, Jetbrains, it is becoming an essential part of Android development. Goal. This study aims to empirically assess the impact of the migration from Java to Kotlin on the run-time efficiency of Android apps. Methodology. To achieve this goal, we mine 7,972 GitHub repositories of Android apps and identified 451 apps containing Kotlin code. Then, by applying a crosslanguage clone detection technique, we detect 62 commits that represent a full migration to Kotlin, while keeping the app functionally equivalent. We sample 10 apps that fully migrated to Kotlin and conducted a measurement-based experiment to compare their Java and Kotlin versions with respect to seven runtime efficiency metrics. Results. Our study shows that migrating to Kotlin has a statistically significant impact on CPU usage, memory usage, and render duration of frames (though with a negligible effect size), whereas it does not impact significantly the number of calls to the garbage collector, the number of delayed frames, app size, and energy consumption. Conclusions. This study provides evidence that developers can migrate their Android apps to Kotlin and expect comparable efficiency at runtime. As a side product, this study also confirms that most open-source Android apps either fully migrated to Kotlin (>90% Kotlin code) or contain low portions of Kotlin code (<10%).I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.