Facebook gives Android a kick in the byte code
Facebook turns its attention to the Redex project for optimizing Java bytecode to improve Android optimization.
To improve the mobile performance of its social network, Facebook is enhancing Java bytecode on the Android platform with its Redex project, providing a pipeline for optimizing Android DEX (Dalvik Executable) files.
In a blog post, Facebook engineers Marty Greenia, Bert Maher, and Shane Ney emphasized a responsibility to “keep things fast,” particularly in developing areas where devices stay in the market longer. “Android is one of our biggest platforms, and it’s also the mobile platform with the greatest diversity of devices. Any performance or efficiency improvements on these devices could improve the experience of millions of people around the world,” according to the post.
For now, at least, Redex will be limited to Facebook’s own platform. While Facebook has been active in releasing software via open source lately, there are no plans at the moment to do this with Redex.
The engineers said Redex applies a series of customizable transformations so a source DEX file can be optimized before inclusion in an APK (Android Application Package). “The advantage of doing our optimizations at the bytecode level (as opposed to, say, on the source code directly) is that it gives us the maximum ability to do global, inter-class optimizations across the entire binary, rather than just doing local class-level optimizations,” the bloggers said. “We opted to perform the transform on DEX bytecodes rather than Java bytecodes because certain transforms can only be done post-DXing.”
The optimization pipeline takes an original DEX file through a series of stages, with each stage serving as a stand-alone “optimization plug-in” snapping in place behind the previous stage. “The Redex pipeline is generalized to allow any kind of DEX transformation,” said the bloggers, “but today we want to focus on using Redex to minimize how much bytecode ships in the APK.”
The post also emphasizes reduction in bytecode. “Fewer bytes also means faster download times, faster install times, and lower data usage for cell users. Lastly, less bytecode also typically translates into faster runtime performance. All other things being equal, less bytecode means fewer instructions to execute and fewer code pages to fault into memory, which is going to be a performance improvement for resource intensive scenarios like application cold start.”
This story, “Facebook gives Android a kick in the byte code” was originally published by InfoWorld.
By Paul Krill http://www.javaworld.com/article/2989901/java-android-developer/facebook-android-dalvik-redex.html
Leave a Reply