ART Technology: What really and what are its advantages? [Atualizado]

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.

br teaser n5
CART and Dalvik! / AndroidPIT

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.

art vs dalvik
Execution time can be reduced by up to 2 times with ART / XDA

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.

memu "sizes =" (max-width: 806px) calc (100vw - 24px), (max-width: 995px) 782px, (max-width: 1216px) calc (2 * (100vw - 30px) / 3) + 15px - 24px), 782px "src =" "srcset =" memu-w782.jpg 782w, 596w, jpg 450w, 336w, 300w "class = "lazyload" />
Is ART a problem for smartphones with low internal memory? / ANDROIDPIT
<h3 id=ART ir saves battery power

Another obvious consequence of the way ART works: If all the apps on your phone are precompiled, the processor will have to work less each time you open them, which leads to lower battery consumption. The downside is that every time you start your device for the first time, it takes a lot longer, especially if it has a lot of bloatware. The same goes for when you first open a new app. After that, however, everything will be faster.

ART Faster Than You Think

The current version of ART running on Android L is obviously an option for developers. When Google announced the definitive move to ART on Google I / O, it was stated that the new virtual machine would be twice as fast as Dalvik, showing a benchmark test as proof:

The speed of Dalvik's ART compared in various benchmark tests. / Google / ANDROIDPIT

But what you may not know is that Google also said other tests showed that ART can be three times faster than Dalvik. We still don't know how fast the machine's final version will be, but Google's strategy of announcing a speed and then surprising everyone with an even faster ART seems plausible.

Have you been using ART on KitKat? What are your impressions?

(tagsToTranslate) technology art (t) technology dalvik (t) android art (t) android dalvik (t) runtime (t) google (t) nexus (t) java (t) vm