Reflection No Reflection - Boosting performance on Android by bypassing Reflection API

UES 5:10pm

Watch Video

On Android, many applications rely on the Java Reflection API. For instance, all data driven apps get data from the network, save data in your local cache files / databases. And most of the libraries used to simplify those tasks will use reflection in their core.

Unfortunately, Reflection is slow on Android due to limitations of Dalvik and Art. The usual workaround is to write annotation processors and replace Reflection by generated code. But, it comes with a price : all the robust and mature libs from Java can't be reused and must be rewritten, often in a degraded, simpler version. And the annotation processor API is quite tricky, leaving this work to a handful of expert coders.

In this talk, we will demonstrate a new approach using the Reflection No Reflection (RNЯ). This new technology provides a much faster access to reflection data, while maintaining compatibility with the Reflection API. Using this technique, any library can swap out use of the Reflection API with this interface-compatible implementation to achieve greater performance.

It also comes with an additional benefit : if you create annotation processors based libs, you can now get rid of annotation processing API when writing an annotation processor : you will be able to use reflection of classes...Yes, before they are even compiled !

Stéphane Nicolas,

With around 20 years of experience of Java programming, Stéphane has been teaching programming and software design for more than seven years to scholars and young professionals. He has realized several Android applications in a professional contexts for different companies: Deezer (France, online music company), OCTO (France, Android consulting) and now Groupon (Canada/US, online shopping) as a Senior Android developer. He focuses on topics like dependency injection, asynchronous networking, testability, robustness and design, continuous integration, and bringing quality analysis to Android.

He is passionate of contributing to open-source libraries, and participates to many of them on GitHub: RoboSpice, RoboGuice, BoundBox, maven-android-plugin, Quality Analysis Tools for Android, Mimic, AfterBurner, RoboDemo, etc. He also actively contributes to the Android community on Stack Over Flow and by participating to international conferences (DroidCons: Paris, London, Amsterdam and Devoxx Paris).