Ever wonder how despite its less than jaw dropping specifications, the Moto X still manages to score quite well in many benchmarks? Unlike some of the other major OEMs out there, Motorola doesn’t rely on benchmark-specific application detection and questionable “optimizations.” Rather, they actually employ genuine speed tweaks, in the form of optimized Bionic and Dalvik libraries.
But before delving further to learn about how you can use optimized libraries to improve the performance on your own Qualcomm-based Nexus device, let’s spend a few minutes talking about these libraries in question. After all, you should know what you’re getting into when incorporating any new system-level tweaks and mods.
Let’s start with Bionic. Bionic (libbionic) was originally created by Google for use in Android, as a derivative of the standard GNU C library originally found in BSD (glibc). Bionic differs from the standard C library in that it is a much smaller library than the GNU C library. Furthermore, it is designed for relatively low powered CPUs like mobile devices. In practice, it is used for various basic math and memory operations.
Now, let’s take a look at Dalvik. Dalvik is the virtual machine used in Android that has much in common with Java virtual machine. But rather than executing standard Java class files, Dalvik relies on DEX files. This is the same DEX that you’ve undoubtedly already heard of when talking about ODEXED and DEODEXED ROMs.
You may also recall how we broke the news on the new ART runtime compiler introduced into Android 4.4 KitKat. ART, which serves as a drop-in replacement for the Dalvik VM, is far more optimized thanks to ahead-of-time compilation rather than Dalvik’s just-in-time compilation. ART compatibility isn’t quite 100% yet, but it is already good enough for many. And while ART necessarily requires greater storage space usage on installed apps, the performance gains may be worth the added storage footprint. Unfortunately though, the popular Xposed Framework is not compatible with ART—and it won’t be for quite some time, if ever.
So what does any of this have to do with the real world performance gains we all crave? Simple: Loading more optimized libraries can potentially result in improved performance. To see this in action, let’s take a look at a particular thread by XDA Senior Member kszaq, which demonstrates how more optimized Bionic and Dalvik libraries can be used on various Qualcomm-based Nexus devices to improve performance.
Where do these optimized libraries come from? The optimized Bionic library comes from the open source Code Aurora Foundation, and the optimized Dalvik library comes from the Moto X. So why weren’t these just implemented into stock Android? That’s a bit harder to answer. The Dalvik optimizations from the Moto X are closed source, so it makes sense that Google would not want to include this in the AOSP and in devices with official AOSP support. The Bionic optimizations from the Code Arora Foundation, on the other hand, are open source. But perhaps, Google simply did not want to have these hardware-specific optimizations a part of the Android as a whole.
If you’ve been wanting to optimize your Qualcomm-based Nexus device’s performance but don’t want to use ART, you should consider implementing these optimized Dalvik and Bionic libraries. Make your way over to the original thread to get started. Just be sure that you have a Nandroid backup before flashing these, as there’s no simple “undo button” when modifying system libraries.
Please note, however, that this only is of benefit to Qualcomm-powered devices. Naturally, CAF’s optimizations will not have any beneficial effect on non-Qualcomm hardware. Furthermore, the Moto X’s Dalvik optimizations are largely unnecessary on non-Nexus devices, as other vendors also use hardware-specific Dalvik optimizations. Basically, you’ll only find this useful for the Google Nexus 5, Nexus 4, and Nexus 7 (2013)—all of which are powered by various Snapdragon chipsets. And it should go without saying that these optimizations are only valid for near-stock, AOSP-derived KitKat ROMs._________
Join us for xda:devcon 2014. For a limited time, XDA Portal readers get 20% off registration!