February 12, 2014 By: Jimmy McGee
XDA community members are known for boosting the performance of their Android devices in much the same way that baby boomers would modify and improve their hot rod cars. One new feature of KitKat is poised to help improve application performance in Android. This feature is known as ART, though it’s still an experimental feature, there is rumor that it will be the default soon. But what is this talk about ART really? And what is ART?
In today’s video, XDA Developer TV Producer Jordan talks about the ART runtime compiler. He gives a basic overview of what ART does. Then Jordan talks about what ART does differently than the current runtime compiler known as Dalvik. So if you want to learn more about the ART runtime, check this video out.
Android 4.4 KitKat is indeed a sweet update. It brought dozens of new features, and its decreased memory footprint allowed it to be ported to older devices relatively easily. One of the most interesting features hidden deep inside developers options is ART, a new runtime compiler poised to replace our good friend Dalvik. What is ART and why should you be interested in it? Let’s dig deeper.
Android uses a virtual machine to execute code. It’s not a perfect solution. And because of this, Android devices need more resources to run smoothly than for example Windows Phone. Dalvik, which is the default runtime, is nothing more than the software that runs the applications on Android devices. Ever since Android 2.2, Dalvik has used a Just-In-Time compiler to interpret bytecode from Java language. Programs written in Java are then converted from a Java class files to a Dalvik Executable (.dex) before installation on a device. An odex is basically a pre-processed version of an application’s classes.dex that is execution-ready for Dalvik. When an application is odexed, the classes.dex is removed from the APK archive, and nothing is written to the Dalvik cache. An application that is not odexed ends up with 2 copies of the classes.dex file: the packaged file in the APK and the processed one in the Dalvik cache. It also takes a little longer to launch the first time since Dalvik has to extract and process the classes.dex file. And for reference, the name Dalvik comes from the name of the fishing village Dalvík in Eyjafjörður, Iceland, where the ancestors of Dan Bornstein (the creator of Dalvik) lived.
Dalvik is still a great project, but the Android developers decided to swap it for a higher performance runtime compiler: ART. This new runtime uses Ahead-of-Time compilation, where the bytecode is precompiled into machine language at the time of installation. That explains why applications installed with ART enabled take longer to install and less time to open. They also require more space, but this shouldn’t be a problem as almost all new devices have tons of internal storage. ART was introduced as an experimental feature in Android 4.4.In its current form, ART is not unequivocally faster than Dalvik in all benchmarks. However, we need to keep in mind that this runtime is still very new and optimization will take time.
According to newest commits in master branch of Android, ART will replace Dalvik in the next version of Android. Dalvik will still be available as an alternative runtime virtual machine to keep compatibility with certain older applications. You might have noticed that some applications like WhatsApp had some issues when Android 4.4 was released, especially for those running ART. However, these were mostly solved quite quickly, and now most apps works flawlessly on ART. This runtime compiler is definitely worth trying, but it is important to keep in mind a few potential cons like bigger apps and some problems with certain applications. That said, it’s a great feature that will only be tweaked further in upcoming releases.
You can read more about ART in an informational thread created by XDA Senior Member PradeepMurugan, who gathered together quite a bit of information and put it all in one place where most of highlighted issues are already covered. The next version of Android will be something big, and hopefully ART will be optimized enough to leave the Dalvik in the dust.
[Thanks to Nathan Strong from Stackoverflow for providing a complete definition of ODEX]
February 1, 2014 By: eagleeyetom
Android has become the major player in mobile operating systems, practically ever since Gingerbread was released. The little green robot has evolved from a small, niche operating system into something of a juggernaut. During the course of these years, Android developers have added tons of handful functions like JIT and ART compiler. Now is a good time to think about the future of the Android, as a few major events are already behind us and some very interesting things are starting to pop up in the Android source code.
For those of you who follow the changes on Android’s Git, news that our favorite OS will go 64-bit isn’t exactly anything new. A few commits in platform/system/core and frameworks/base indicate that Google has already started the process of transforming the OS. Those commits were pushed by Google’s employees, so it is safe to consider them “official.” This move should not be a bit surprise, as Apple already released a product with the 64-bit ARMv8 instruction set. Apple’s iPhone 5S doesn’t fully support 64-bit architecture, but Google has plenty of time to make software adjustments to make Android compatible with newest ARM processors. 64-bit Android has been already announced by Intel to support their new Atom Bay Trail CPUs this coming Spring. Intel-based devices are a relatively small percent of the market, so the timing will most likely wait for ARMv8-based processors instead. It won’t happen in a month or two, but first units should be presented in the second quarter of this year.
What changes will 64-bit bring, and why we should we be excited? For starters, this will bring support for greater than 4 GB of RAM. And although PAE theoretically allows for greater than 4 GB of addressable space on 32-bit processors, individual apps still are limited to far less. It can be expected that we will see flagship devices from Samsung, Sony, HTC, and LG ship with 4 GB of RAM when this support is live. At present, “4 GB” is just a number, as most apps won’t use it. The greatest Android applications are quite small and consume less than 100 MB of RAM. 4 GB can be used by some high end games in the future, but perhaps other market forces will limit this. Personally I think that manufacturers should focus on improving the battery life instead of packing more cores, more RAM and more of everything into their top devices in this specsheet war.
Another benefit will be the support for a more optimized 64-bit instruction set in the case of ARMv8. However, application developers will need time to add some architecture-related tweaks to their projects, and this will obviously take some time. Going back to the first AMD64 (x86-64) CPUs on personal computers, it took several years before they were commonplace enough to be considered mainstream. We shouldn’t expect anything different in Android’s open ecosystem.
ARMv8 won’t be much better on day one than ARMv7. In time it should dominate the market, but first devices shouldn’t really differ in terms of performance. This platform still needs a lot of work and optimization before we can consider it stable. It’s almost sure that first flagships with Android supporting 64-bit will show up at the beginning of 2015 as the Qualcomm Snapdragon 805 planned to be released in the second half of the year will still support only 32 bits.
Another interesting thing to note is that the next version of Android despite breaking root, will also use ART compiler as its default runtime compiler rather than JIT. We will present additional details about ART in an upcoming story, and in the meantime you can check the commit detailing the change in default runtime compiler. It appears that Dalvik will be available as an alternative, so those of you who use Xposed Framework can sleep well from now until Xposed is updated to support ART.
Many changes have occurred in Android recently, and hopefully more will happen in the coming months. One thing is sure: We’ll be sure to keep you informed of all of the interesting details!