In simple terms, ART stands for Android RunTime environment i.e. environment used by the Android operating system to run the applications. This is a successor to earlier virtual machine “Dalvik” which was part of the Android operating system until Android 4.4 (KitKat)
What are the key features of Android Runtime (ART)?
ART introduced use of “Ahead of Time (AOT)” compilation of all the applications. When an application is installed on Android system, Java bytecode is translated into machine instructions during the compilation process. This improves the application execution performance tremendously. In earlier days when Dalvik was part of the Android OS, the applications used to be compiled “Just In Time (JIT)” before execution. This used to slow down the execution performance of the applications.
You would be wondering why would someone choose JIT compilation. Remember those were the days when mobiles were not as powerful as today’s mobiles. They used to have lower storage and Android was forced to have lower sized applications as a constraint. The compiled versions of the applications tend to be slightly higher in size and hence this trade-off.
Another drawback of Dalvik Runtime – it used to consume battery as it used to compile the code everytime application is started.
By introducing AOT, Android Runtime saves a lot of battery consumption and also improves the execution performance. Albeit there’s a small price to pay – application installation takes longer as compared to the installation times on Dalvik. This is because the code is compiled during installation. However, as you would agree, this is a small price to pay.
Among other benefits of ART, memory allocation and garbage collection are important ones. It also provides some debugging features and high-level profiling of the applications.
ART provides backward compatibility with Dalvik. So if your application runs well on ART, it will work well on Dalvik too. However, the reverse may not be true.
Java Runtime Environment (JRE), Dalvik, JIT, AOT, JVM, Bytecode,