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!

Tomek Kondrat

eagleeyetom is an editor on XDA-Developers, the largest community for Android users. Tomek is the only Polish moderator on XDA Developers. He graduated from the University of Warmia and Mazury in Olsztyn with a degree in journalism and public communication in 2013. He's a big fan of football (not hand egg), post rock and cooking. A total addict of mobile technology, especially Android. Currently flashes dozens of custom ROMs on his OPO. View eagleeyetom's posts and articles here.
Aamir Siddiqui · Jun 30, 2015 at 02:43 pm · 3 comments

Beats Music No Longer Accepting New Accounts

Whenever Apple launches a new product or service, it definitely manages to grab the attention of all. Whether you love the company and or its products, or you hate it, there's no denying that Apple does make more people interested in things, old or new. When the company announced Apple Music, it directly took aim at the user base of iTunes which had migrated to the streaming convenience of Spotify and later, Google Play Music. In order to further bolster...

XDA NEWS
Emil Kako · Jun 30, 2015 at 02:37 pm · 3 comments

Do You Do Self-Repairs on Your Devices?

As smartphone designs become more and more complex, self-repairs on devices are also becoming more complicated. Unibody handsets like HTC's One flagship series can sometimes be a nightmare to repair if the person doesn't have much experience. That, of course, all depends on the device you are attempting to repair though. So, how many of you do self-repairs on your devices? Let us know why or why not in the comments below.

DISCUSS
Faiz Malkani · Jun 30, 2015 at 02:03 pm · 3 comments

Sony Z4 Slips Out of Top 5 Smartphones in Japan

In a bid to streamline its flagship series which had been losing credibility over the past few years due to their 6 month release cycles, Sony announced that releases would be pushed back to the standard duration of one year instead. When Sony's 2015 flagship was unveiled as the Z4 in Japan and the Z3+ across the rest of the world, enthusiasts everywhere expected things to take a turn for the better, in lieu of the aforementioned announcement. However, two months...

XDA NEWS
Share This