Tomek Kondrat · Feb 2, 2014 at 07:00 pm

The ART of Android

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]


_________
Want something on the XDA Portal? Send us a tip!
Emil Kako · Mar 1, 2015 at 04:12 pm · no comments

Samsung Galaxy S6 VS HTC One M9: Which Do You Prefer?

After months of anticipation, both the Samsung Galaxy S6 and HTC One M9 have finally been unveiled. Now that we have all seen both of the devices in all their glory, many of us have some decisions to make. Which of the two beasts do you prefer: the Galaxy S6 or the One M9? Let us know which device you plan on buying and why!

DISCUSS
Mario Tomás Serrafero · Mar 1, 2015 at 04:04 pm · 1 comment

Samsung Unpacked Coverage: All About the S6

Samsung's Unpacked Event has now come and gone through Mobile World Congress 2015, and we've got a good look at what could be the most advanced phone of the year thus far. The event started shortly after its scheduled time at 12:30PM today and the only devices shown were the Galaxy S6 and its Edge variant, both of which pack an impressive amount of features, spectacular internals and an all-new beautiful design. The show began with a quiet voice whispering to...

XDA NEWS
Chris Gilliam · Mar 1, 2015 at 03:59 pm · 1 comment

Samsung Galaxy S6 Cameras

Each year, smartphone makers attempt to one-up each other in features and specs, but time and again these improvements feel incremental rather than revolutionary. Samsung hopes to break this trend with a new hardware and software design philosophy, and press details of the new-and-improved cameras shared by the S6 and S6 Edge show that they are off to a great start. Once you get past the curved displays and wraparound Gorilla Glass 4, the most striking feature on these slabs is the...

XDA NEWS
Share This