Everyone reading this no doubt loves Android, but how many of you know how Android runs? Android apps are written in the Java programming language but how is that converted into a language that can be read by our devices, considering the hardware is not powerful enough to have its own Java virtual machine?
Way back when Android was created, a mobile virtual machine was also created, the Dalvik VM. The Dalvik VM is a virtual machine that runs apps written in Java, the runtime. Android often struggled with multitasking in the early days, due to the intense nature of interpreting the Java bytecode and converting that to a machine-executable format. Google added a Just In Time (JIT) Compiler to the Dalvik VM. Without going into a lot of detail, a JIT compiler allows the virtual machine to pre-compile bytecode into machine language, and caching it for future use, thus allowing some code to execute natively, and thus, faster.
JIT sped Dalvik VM up considerably but it now seems that Google are looking to the future and want to make Android as smooth and as fast as possible.
With the release of Android version 4.4, KitKat, Google have released an experimental version of a new runtime, called ART. While the Dalvik VM compiler is employed as the application is running, that is, Just In Time, ART on the other hand generates the machine code from Bytecode and stores this for future use. This results in the code being compiled well ahead of time (instead of just in time), thus saving not only time at execution, but by making it more efficient this way it can also save battery life as less has to be done each time a process runs.
At this stage the default runtime compiler is still Dalvik, and ART is hidden away as it can break things, but it can be implemented within a ROM if someone wanted to test it out and provide some feedback to Google.
A week or 2 ago we reported that Google had purchased Flexycore for a substantial amount of money and we were excited with Google thinking about speeding up Android even more. It now seems that Google may have purchased Flexycore so they can somehow help them in their development of their ART runtime compiler. While ART is still experimental, it can be implemented within the developer settings and while some are having more success than others it seems that some benchmarking has shown that ART is a lot faster and more efficient than DalvikVM.
Ever wondered why iOS can be so smooth all the time? A big part of it is likely iOS’ use of native, machine level code — unlike Android where developers compile their Java sourcefiles to bytecode, iOS developers compile their Objective C straight to machine code, which executes rather quickly. It is the step of having to compile the code into a format that can run in Android that takes time. It is thought that Google’s idea is that using ART instead of Dalvik VM will save time and put it on a par with other mobile operating systems such as iOS and Windows Phone that use machine code. It is this part that seems to have everyone excited. Combine this ability to compile code beforehand with the superior processors and hardware in Android devices and we could be in for some exciting times ahead in the Android world.
The last few releases of Android have seen many under-the-hood enhancements and less of the whiz-bang glossy features that wow audiences. There have been many things that Google have introduced to Android that have made it run smoother and faster but this could be the most exciting thing to possibly come to Android in recent times.
Are you as excited as us about this development with Android as I am?