Paul Krill
Editor at Large

Facebook gives Android a kick in the byte code

news
Oct 2, 20152 mins

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.”

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author