Improved Android Runtime
In the early days, most smartphones had very little RAM. So the first Android runtime implementation, called Dalvik, used a strategy of interpreting small chunks of code at runtime, before actually running them to optimize RAM usage.
The next major Android release, Android L, brought a much-improved runtime, named Android Runtime (ART). It introduced an approach called Ahead of Time compilation. Instead of interpreting code at runtime, which was the traditional method in Dalvik, ART compiled application code ahead of time and then executed it natively on the device. This strategy greatly improved performance compared to Just in Time compilation.
ART has a number of optimizations to improve app performance. It uses profile guided compilation to pre-compile parts of an app’s code that are most frequently executed by previous users. It also has tighter install-time verification than Dalvik.
Another important optimization is a new technique to help manage memory allocation and garbage collection. This reduces CPU cycles and improves battery life.
Aside from these optimizations, ART is backward compatible with Dalvik, which means that apps developed for ART can work on devices running Dalvik as well.
ART is a major step forward in optimizing application performance on Android. Unlike Dalvik, which only compiled application code in the very last minute before executing it, ART recompiles all of an app’s Java bytecode to machine instructions right before the application is run. This technique, called Ahead of Time compilation, is claimed to be 20 times faster than Just in Time compilation.