22

With Nexus 5 (Android 4.4 KitKat), Google has shipped two runtimes to run apps.

Select Runtime option in Android 4.4 KitKat Dalvik and ART Runtimes in Android 4.4 KitKat

What are the differences between Dalvik & ART for endusers? How can endusers be affected by this? Is there any specific reason I should choose new ART runtime?

  • 3
    The fact you have to enable and search through the Developer options to find this setting should be a hint that it's not intended for end users. – Dan Hulme Nov 11 '13 at 12:29
  • 1
    @DanHulme Nice point, but still non-developer enthusiasts do play with Developer options & they even use it for positive non-development purposes many times. – Android Quesito Nov 11 '13 at 12:32
  • As far as user experience is your point then you will only notice that battery power is saved to much extent,... however you will not be able to see the speed difference while switching from Dalvik to ART. – Rahul Raina Nov 21 '15 at 12:34
26

Dalvik VM (Virtual Machine) is Google's version of a Java VM (on which apps run). VMs keep apps isolated and independent from actual hardware and other apps. But, for this to work, Dalvik needs to convert so called bytecode (designed for virtual machine) to native machine code. In order to minimize the performance penalty that the bytecode to native code conversion introduces, a process called Just-In-Time (JIT) compilation is performed, which converts hot, i.e. often used, bytecode to native code.1

ART (Android Runtime) is a replacement for Dalvik that uses Ahead-Of-Time (AOT) compilation, meaning your apps are compiled to a ready-to-run state before you even launch them. This is usually done, at the time of app installation, making the process of launching and using them much faster and smoother. And since this means that compilation is only done once, you may also see better battery life, too.

If ART is better on performance & battery life perspective, should I start using it?

No. If you do that, you may break third-party apps. Google has shipped this ART preview with Android 4.4 for developers to test their apps on it.

Side Note: Google's approach with ART is to beat iOS (iOS apps are native so performs better even on low-end hardware specs), but I don't know where it is heading... Another fragmentation? See OEMs are free to build devices using either one or both. While final version shouldn't affect most of apps, but its not 100% cross-platform thing.

1Note that JIT was added to Dalvik in Android 2.2

  • 3
    Maybe two facts are worth noting along: ART's AOT results in apps using 20..25% more storage compared to DEX. Plus tests on a Nexus-5 I've read didn't show any differences in subjective speed nor battery endurance. Both will certainly improve, considering ART in KitKat being just a developers' preview and compatibility check (which e.g. WhatsApp failed). So I second Sachin's conclusion: It's not yet good for end-users. – Izzy Nov 11 '13 at 13:22
  • 2
    Excellent answer. I took the freedom to improve it a bit. But I don't agree with the last paragraph: ART does not increase fragmentation: If ART is considered production ready, it shouldn't matter if your App is run by Dalvik or ART, both use the same .dex format as starting point. Only that ART does AOT compile the .dex to native code. – Flow Dec 2 '13 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.