ART replaces Dalvik

    I want to share interesting news about a new feature that appeared in Android 4.4, which was not mentioned at the presentation or in the reviews that appeared after the presentation - about the new application runtime environment on the mobile OS - ART, which replaces the venerable Dalvik. Potentially, this can greatly improve application performance without the need to recompile them. Of the minuses - a longer installation time, a larger occupied size, some functions may not work. The goal of the post is to convey accessible information to a reputable community and learn more about technology.

    So far, I managed to find such information on the website
    The last few years, an important part of the work of the creators of Android has become the fight against the main inborn "disease" of the system - lags in the animation of the interface. The first serious step in this direction was Project Butter, announced along with Android 4.1 Jelly Bean and really “accelerated” the system, but did not solve the problem fundamentally. 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 production processors, under a certain set of circumstances, you can notice that the animation in Android is not rendered perfectly, and there are visible hitches between some actions. The problem is complex, therefore, to solve it, many steps had to be taken - as one of them they decided to change Dalvik to the ART precompiler.

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

    ART is an AOT-Of-Time 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 you can activate it in the developer's menu. After switching to (the compiler library), the device reboots and compiles all installed applications. The guys from Android Police, who carefully studied ART, argue that this is not worth doing on custom firmware from AOSP yet - there may be problems with the software package from Google.

    Even taking into account the incomplete state of ART, the transition to it significantly affects the speed of resource-intensive tasks and the smooth operation of the interface, and also allows multi-core processors to disable unused kernels more often, which gives a gain in the battery life of the device. The new compilation system has disadvantages, although it is difficult to call them significant: a longer installation time and an increase in the final program size by 10-20%. True, the size of only the code part is growing, which often takes less than half of the application - multimedia (pictures, sound, video) and other data do not change their size.

    It turns out that Google has been working on ART for more than a year and including it in KitKat is an absolutely deliberate solution that allows the creators of the system to conduct serious testing, and application developers to prepare for the upcoming Dalvik “departure”. It is not yet clear how much the FlexyCore developers, which Google bought in October of this year, influenced the new compiler, but the project began inside the search giant itself.

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

    I don’t 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 devices with Android 4.4 not from Google: Samsung, HTC, etc. Will all the functions of the application work correctly after the transfer to a new platform?

    There is very little information, please write in the comments, where you can get it in a larger size.

    Also popular now: