Expo SDK 56 introduces a Kotlin compiler plugin that eliminates runtime reflection from Expo Modules on Android. The plugin intercepts calls to type resolution functions and Record property lookups at compile time, replacing them with pre-computed descriptors and direct field accessors. Results on a module-heavy test app show 70% faster module initialization, 30% reduction in time to first render, and 6x faster Record conversions. App developers get the gains automatically; module maintainers can opt into the Record speedup with a single @OptimizedRecord annotation. The post explains why code generation approaches (kapt, KSP) were rejected in favor of the K2 compiler IR API, which allows surgical in-place transformations rather than generating parallel code files.

10m read timeFrom expo.dev
Post cover image
Table of contents
Reflection and the history behind itThe real cost of reflectionWhy we didn't go with code generationWhat changed with K2What the plugin doesPerformanceWhat you need to doWhat's next
4 Impressions