Jun 26, 2014

What will be the difference if Dalvik is replaced by ART in Android?

There have been indications that Google will be replacing Dalvik with ART in the next version of Android. What difference will this make to developers and consumers? Will there be noticable benefits?


The short version: the next version of Android with ART instead of Dalvik runtime load a little faster, run a little smoother and be slightly more power efficient for improved battery life, but at the cost of a little more space. 


"ART Features
Here are some of the major new features implemented by ART.

Ahead-of-time (AOT) compilation

ART introduces ahead-of-time (AOT) compilation, which can improve app performance. ART also has tighter install-time verification than Dalvik.

At install time, ART compiles apps using the on-device dex2oat tool. This utility accepts DEX files as input and generates a compiled app executable for the target device. The utility should be able to compile all valid DEX files without difficulty. However, some post-processing tools produce invalid files that may be tolerated by Dalvik but cannot be compiled by ART. For more information, see Addressing Garbage Collection Issues.

Improved garbage collection

Garbage collection (GC) can impair an app's performance, resulting in choppy display, poor UI responsiveness, and other problems. ART improves garbage collection in several ways:

One GC pause instead of two
Parallelized processing during the remaining GC pause
Collector with lower pause time for the special case of cleaning up recently-allocated, short-lived objects
Improved garbage collection ergonomics, making concurrent garbage collections more timely, which makes GC_FOR_ALLOC events extremely rare in typical use cases
ART currently does not use compacting GC, but this feature is under development in the Android Open Source Project (AOSP). In the meantime, don't perform operations that are incompatible with compacting GC, such as storing pointers to object fields. For more information, see Addressing Garbage Collection Issues."
Answer this