Expo Jun 10, 2026

How a Kotlin compiler plugin cut Android time to first render by 30%

Article Summary

Łukasz Kosmaty from Expo just shipped a compiler plugin that cuts Android app startup time by 30%. No code changes required for developers.

Expo SDK 56 introduces a Kotlin compiler plugin that eliminates reflection overhead from module initialization. The plugin transforms expensive runtime operations into compile-time code generation, targeting the two biggest bottlenecks: type metadata resolution and Record object conversion.

Key Takeaways

Critical Insight

Expo SDK 56 automatically delivers 30% faster time to first render on Android by moving reflection work from runtime to compile time.

The article reveals why they rejected standard code generation approaches and what the K2 compiler unlocked that wasn't possible before.

About This Article

Problem

Expo Modules used runtime reflection to figure out type information for function arguments and Record properties. This meant the JVM had to parse binary @Metadata annotations and rebuild Kotlin's type system every time the app launched cold.

Solution

Łukasz Kosmaty's team wrote a K2 compiler plugin that catches typeDescriptorOf() calls and @OptimizedRecord annotations at compile time. Instead of using reflection, it swaps them out for pre-computed type descriptors and baked-in Record metadata that use direct index-based field access.

Impact

Cold launch Activity.onCreate improved from 93ms to 55ms, a 41% drop. Time to first render went from 797ms to 508ms, down 36%. Record conversion became about 6x faster than SDK 55. App developers didn't need to change any code.