Info

How R8 made Kotlin Coroutines on Android 2x faster

How R8 made Kotlin Coroutines on Android 2x faster illustration

How R8 made Kotlin Coroutines on Android 2x faster Posted by Andrei Shikov, Senior Software Engineer, Android Toolkit and Jonathan Starup, Software Engineer, R8 Team Starting from AGP 9.2.0, R8 optimizes most Atomic*FieldUpdater calls into Unsafe variants that perform 2x to 4x better on common operations. This has a particularly large impact on the kotlinx.atomicfu library that implements atomics for kotlinx.coroutines , making launching and cancelling coroutines up to 2x faster.

In order to get the benefits, update your AGP to 9.2.0 or above. With the majority of Android apps adopting Kotlin as their main language of choice, kotlinx.coroutines has become a de-facto standard for asynchronous programming.

The library offers a.

Leave a comment