📜 ⬆️ ⬇️

ART is replacing Dalvik

I want to share an interesting news about the new feature that appeared in Android 4.4, which was not mentioned at the presentation and in the reviews that appeared after the review - about the application execution environment on the mobile OS - ART, which replaces the respectable Dalvik. Potentially, this can greatly improve application performance without having to recompile them. Of the minuses - more installation time, a larger occupied size, possibly inoperability of some functions. The purpose of the post - to bring to the respected community available information and learn more about technology.




While it was possible to find such information on the site Youhtc.ru
"
The last few years, an important part of the work of the creators of Android has been the fight against the main innate "disease" of the system - lags in the animation interface. The first serious step in this direction was Project Butter, announced together with Android 4.1 Jelly Bean and really “accelerating” the system, but did not solve the problem radically. Google is aware of this, so they are preparing ART - a replacement for the Dalvik virtual machine.
')
Even now, in the age of multi-core productive processors, with a certain set of circumstances, it can be noted that the animation in Android is not perfectly drawn, and there are visible hitch between some actions. The problem is complex, because for its solution it was necessary to take many steps - as one of them they decided to change Dalvik to the ART precompiler.

Now the Android code is executed in a Java-machine, created by Google specifically for mobile devices, while it is “on the go” converted into hardware (Just-In-Time Compilation). Such a mechanism allows the application developer to practically not be tied to a specific architecture or hardware, but causes serious performance damage, loading the processor at compile time. Of course, after the first “decelerated” program launch, a part of the received “native” code is saved in the cache, but this does not completely solve the lag problem.

ART is an AOT compiler (Ahead-Of-Time), which converts Java code to “native” during the installation process. That is, the user starts the program already compiled, which significantly speeds up its opening and execution. It is doubly interesting that ART is already built into Android 4.4 KitKat and can be activated in the developer’s menu. After switching to libart.so (compiler library), the device reboots and compiles all already installed applications. The guys from Android Police, who carefully studied ART, argue that on custom firmware from AOSP this is not worth it yet - there may be problems with the software package from Google.

Even taking into account the inconclusive state of ART, the transition to it significantly affects the speed of execution of resource-intensive tasks and the smoothness of the interface, and also allows multi-core processors to disable unused cores more often, which gives a gain in autonomous device operation time. There are disadvantages in the new compilation system, although they can hardly be called significant: a longer installation time and an increase in the final program size by 10-20%. True, the size of the code part only grows, which often takes up less than half of the application — multimedia (pictures, sound, video) and other data of its size do not change.

It turns out that Google has been working on ART for several years now and including it in KitKat is an absolutely thought-out solution that allows system creators to conduct serious testing, and application developers to get ready for the upcoming Dalvik “care”. It is not clear how much the new compiler was influenced by the developers from FlexyCore, whom Google bought in October of the current year, but the project began within the search giant itself.

Google is not told yet how soon ART will replace Dalvik, but nothing prevents the corporation from doing this in the next version of the system. It is interesting that, like Project Butter, the compiler does not require labor from application developers - they will still write code in a well-known language, using proven practices.
"

I do not have a device on Android 4.4 to try the new technology myself, but the image of the system from Google is already available, which you can “touch” in the emulator.

I still have questions, whether this feature will be available on other Android 4.4 devices not from Google: Samsung, HTC, etc. Will all the functions of the application work correctly after the transfer to the new platform?

Very little information, please write in the comments, where it can be found in a larger size.

Source: https://habr.com/ru/post/201346/


All Articles