This blog has been moved. Please click to open the post in blog.rambabusaravanan.com

This blog has been moved. Please click to open the post in blog.rambabusaravanan.com

Android Powered Devices have virtual machine in which apps run is one of the huge advantage. Android has been using Dalvik Virtual Machine which make use of JIT (Just-In-Time) Compiler since first version of it. Now it is the decision by Google to include a new runtime in Android 4.4 KitKat known as Android RunTime (ART) which make use of Ahead-Of-Time (AOT) Compilation that promises to make your device faster and your battery last longer ..

Android Virtual Machine : Dalvik vs ART

Android Virtual Machine : Dalvik vs ART

Before we jump into this brand new VM, and why it’s turned off by default, let’s make sure everyone understands what we’re talking about ..

Virtual Machine

Virtual Machines are not physical machines but as a software makes possible to run other machines in a your physical machine. For example consider you having a Windows Machine (Assume as it is the only physical machine you are having with you) and if you want to use a Linux or a Mac System, then Virtual Machine paves the way to running a Linux machine or Mac Machine in your Windows Machine ..

Advantages

One of the advantages is the physical separation of each environment in which all the apps (including viruses, malware, and even crashed apps) are all kept apart from your main OS ..

And the next thing is the ability to run programs written for one architecture on a box that runs something different. For example, the ability to run programs compiled to run on an ARM-based CPU when your computer is running an Intel-based processor ..

Android and VM

In order to target different many devices like Tablet, Smartphones, PC, TV, Watch and other gadgets running Android on different hardware architecture, Android uses a specialized virtual machine to run their apps ..

The concept lies here. Developers write code and we download those from the Play Store or some other source. This code is mostly uncompiled. When you use those, it gets comipled to target(in otherwords ‘according to’) the type of device we are having ..

Dalvik (JIT Compilation)

Usually Android uses Dalvik Virtual Machine to compile and run. The concept of Dalvik lies here. Dalvik VM uses JIT (Just-In-Time) Comiplation, which means the downloaded and installed app remains uncompiled untill it’s first launch. And when it is launched first time, it gets compiled just in that time and loaded into RAM (main memory) and hence the name Just-In-Time Compilation. This whole process repeats again when the app/os gets restarted ..

ART (AOT Compilation)

Now Android 4.4 KitKat includes a new runtime call “Android runtime”, ART. Unlike JIT, which must compile every app everytime whenever it’s loaded, ART works on a concept called ahead-of-time (AOT) compilation. The Concept lies here. When you download and install an app it automatically pre-compiles. This takes up more space on your device and takes longer to initially install when compared to Dalvik. However, apps launch quicker and are arguably faster when run using ART rather than Dalvik. What’s more, since less time is required to run apps, your processor doesn’t get worked as hard and your battery life may benefit as a result ..

ART is not set Default

ART is currently very experimental. Not every app works properly in ART, and if you already installed all your apps under Dalvik, you’ll need to reboot and wait up to 20 minutes (less if you have fewer apps, more if you’ve got a bunch) for that first boot to complete. You see, it’s got to pre-compile all of them so they’re ready for you. For all of those reasons, ART is disabled by default ..

Benefits

As based on reports from various sources, it is approximated as follows

  1. 50% – 100% increase in speed
  2. 25% increase in battery life

AOT compilation is the future, and ART is the way Google is going to get us there. This is just the first little step toward a much more lofty goal. Perhaps ART will be the standard runtime in Android 5.0 ..

For further more information visit here ..

Comments
  1. Chris Cassil says:

    Found ART on a fluke and enabled it, then went to read about it where I came across this article. Thanks for the overview and I am looking forward to seeing some latency reduction on the app launch for the Note Edge. granted there isn’t much latency but just to compare would be cool.

    The conversion update took about 30 minutes after recompiling about 407 apps. The CPU was very hot at the end of the optimization, WiFi didn’t work (It’s on but isn’t connecting as it normally would) and I rebooted again. Another 100 apps had to upgrade.

Leave a comment