Along with Android 4.4 KitKat, launched late last year, Google decided to ship the new version of the virtual machine of its mobile operating system, the ART (Android Runtime), which promises to make running apps much more efficiently. With the official launch of Android L approaching, it has already been announced that ART will step out of its testing phase and effectively replace the virtual machine. Dalvik. In this article, I explain in detail what ART, how it will work and also its advantages and potential disadvantages.
What ART or Android Runtime?
To understand the benefits of the new runtime ART, we have to resort to technical details of both systems. Apps running today on Android use a virtual machine (MV) called Dalvik, created by Dan Borstein from the first version of the system. Basically the programs are written in Java and then converted into machine code called bytecode – An intermediate step between the source code and the hardware readable code. At this stage, the code is not associated with any specific machine code and can be converted to run on several different architectures (portability). Finally, the MV Dalvik translates to bytecode It is a code readable by the machine in question, code that is actually executed by the main processor. This translation (compilation) occurs during the execution of the application, which gives the technical name used for this: JIT (Just In Time).
O ART, in turn, was designed to use a compilation technique called AOT (Ahead Of Time). Its main difference from Dalvik is that it occurs before of application execution – not during, like JIT – which eliminates this step during execution time. Thus, an execution speed increase of up to 2 times compared to Dalvik is expected, reducing the perception of delay.
By way of illustration, here is a benchmark chart of a simple value sorting algorithm (quicksort) Runs on an Android device under ART (red), Dalvik (blue), and Java Native Interface (orange), a technique that allows a Java program to access applications and libraries written in lower language, such as C / C ++ / Assembly.
Advantages and disadvantages of ART (Android Runtime)
Apps will get faster, but also take up more memory
This is a consequence of the very nature of Android's next virtual machine: if an application is kept ready to run, of course it will take up more space. Because the app code is compiled when you install it, and then kept in memory instead of compiling each time you open it, it means that it takes up extra permanent space. This can cause problems for low memory devices, and the higher speed always comes at a price. It is too early, however, to know the concrete consequences of this for input devices such as Android One or Moto E.