[OT]ART compiler for Android 4.4 Explained by me.

69 views
Skip to first unread message

Sanket Shah

unread,
Nov 12, 2013, 11:08:25 AM11/12/13
to indian-...@googlegroups.com

Android 4.4 KitKat ushers in several new and exciting features with the new Nexus 5 (and further updates from Google to other Nexuses too).One of the most exciting,underdeveloped feature is a Real time compiler engine ART which has caught many eye balls in the media and among the developer community recently. Some say that its due to Google new purchase start-up Flexycore is the reason behind but seeing the commits in the AOSP tells a different story that google was developing it even before the launch of Nexus 4 and So ,Flexycore has nothing to do with it until recently when they joined Google for improving the ART run time. In simple words its a near replacement to today’s used Dalvik VM run time, the software responsible for all apps working  in Today’s Android Phones

What is ART ?

ART stands for ” Android Runtime ” written in C/C++ native language which Google claims to replace the way apps are fundamentally handled by Dalvik. The dalvik runtime uses Just-In-time (JIT) compilation method to interpret the bytecode ,a exclusive version of the application code.So if you want to understand this , its like the apps written by developer are partially compiled and build ,now this compiled file is ran through a device and its decoded every time it is ran on the device.This process is cumbersome and also not so efficient (though it is used in this way only for now) But the only advantage of this thing to be used is that it allows it to run on variety of Hardware platform ( wiz. ARM,x86 ) unlike other platforms lke iOS , Windows(to some extent) , without developers needing to do anything extra for making it run on other platforms ( and this is great).Also ART requires 50% less time for app startup.

Readwrite has a better example to make it understand for people:

Imagine: every time you open an app, all the different parts of the smartphone responsible for making that app work have to scramble to assemble the code for the app to make it work on your device. You close the app and all those parts relax. You open it and they scramble again. This is not a very efficient way to run apps but it allows those apps to run basically anywhere (what dalvik does)

How does ART work then ?

ART doesn’t work anything differently like what we call it in India as Rajnikanth thing ( translate : a task impossible to perform).ART uses a new approach to set-up this task it pre-compiles this task and converts it into Low level Machine language (simplest form a machine understands code) when they are first installed .This pre conversion is called as Ahead-of-Time(AOT) compilation techique which allows the apps to be truly native apps when they are installed during first BOOT (first installation takes a lot of time).At present though its in developing stages and Google warns it to users to use only if you want to risk your phone and stil keep dalvik as your default runtime only (if you run 3rd party-apps).ART can be switched on from   Settings -> Developer options -> Select runtime .Remember first BOOT can take seriously 10-20 minutes to complete as ART converts existing Dalvik runtime (libdvm.so) to the ART compatible  (libart.so) and also   rather than the ODEX files read by the Dalvik VM, ART appears to use OAT files. you can even find file on AOSP.

Android Police Cody toombs  :Warning: Do not try this with the Paranoid Android (or other AOSP) build right now. There is an incompatibility with the current gapps package that causes rapid crashing, making the interface unusable and also explains that :

For now, the potential gains in efficiency are difficult to gauge based on the version of ART currently shipping with KitKat, so it isn’t representative of what will be possible once it has been extensively optimized. Thus far, estimates and some benchmarks suggest that the new runtime is already capable of cutting execution time in half for most applications. This means that long-running, processor-intensive tasks will be able to finish faster, allowing the system to idle more often and for longer. Regular applications will also benefit from smoother animations and more instantaneous responses to touch and other sensor data. Additionally, now that the typical device contains a quad-core (or greater) processor, many situations will call for activating fewer cores, and it may be possible to make even better use of the lower-powered cores in ARM’s big.LITTLE architecture. How much this improves battery life and performance will vary quite a bit based on usage scenarios and hardware, but the results could be substantial.

 

ART actually has two compiler backends, both Ahead-of-Time. And one of them is based on LLVM! (The new rock star in the world of compilers) LLVM(which allows machine language code to be understood), with its more modular design, has managed to evolve at a very fast rate and take on the big guns (GCC, cl.exe) in a very short amount of time. Although most of LLVM’s strengths seem inapplicable here. ART is awesome Strikes a good balance between portability and performance,but ART is not very innovative. There also have been many successful attempts at speeding up Dalvik in the past but failed to do

(P.S: The phrase “Ahead-of-Time” is unnecessary, but when talking about JIT on already compiled code, simply saying “compiling” can be confusing, so AOT hence the redundant phrase.)

So is Dalvik bad ?

....

Click Here to Read more on my Blog

-Sanket Shah

shaswat doctor

unread,
Nov 12, 2013, 1:06:53 PM11/12/13
to Indian Android Users Group

Well written and explained.. At least for a non tech guy, thoda thoda samajh aaya

Thanks & regards

Shaswat S Doctor
(sent from my tablet Samsung Note 10.1)
~• Twitter: @shaswat_doctor • G+: shaswat.doctor • LinkedIn: Shaswat Doctor •~
BBM: 758AADBF

--
╔═════════════════════════╗
 
Powered by → http://IAUG.in
Twitter → @AndroidINForum

╚═════════════════════════╝
Disclaimer - If you are sharing any Apk file in group, it is your responsibility. We always encourage our members to buy the application.
---
You received this message because you are subscribed to the Google Groups "Indian Android Users Group (IAUG)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to indian-androi...@googlegroups.com.
To post to this group, send email to indian-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/indian-android/11add427-e12b-49ac-9f93-e94cd4ed6a93%40googlegroups.com.

Sanket Shah

unread,
Nov 12, 2013, 1:07:50 PM11/12/13
to indian-...@googlegroups.com
Thank you!

-Sanket Shah A.k.A Sourcex
 


Paijwar

unread,
Nov 12, 2013, 1:16:24 PM11/12/13
to indian-...@googlegroups.com
Thank you for wring in depth article about ART.

I have a question if someone can answer

ART that is going to come in near future is at software level.

Why not google had implemented it at hardware level, by doing this they can bring down the hardware requirement to very low level and it will bring down the overall cost of android devices with great performance?

-Pradeep

---------------------------------------------



Sanket Shah

unread,
Nov 12, 2013, 1:23:13 PM11/12/13
to indian-...@googlegroups.com
I didn't get your question!
What do you mean by implementing at hardware level? As in Using hardware only compatible for a particular optimised softwares ?

-Sanket Shah A.k.A Sourcex
 


Paijwar

unread,
Nov 12, 2013, 1:42:12 PM11/12/13
to indian-...@googlegroups.com
I mean hardware level is 

As ART will be like implementing state machine which will decode or execute bytecodes, as it is doing a processing job, it could be implemented like a processor at hardware level




---------------------------------------------



Sanket Shah

unread,
Nov 12, 2013, 1:48:19 PM11/12/13
to indian-...@googlegroups.com

Ya it can be but it won't be easy to suffice range of hardware android supports
It might be good for a certain arm device or a x86 device but not for all
So Google might need to come up with something awesome to implement it at hardware level
As far as software is concerned you can easily (sarcastic)debug the code and find a solution but for a hardware level circuit its not easy to do ..!
But project Ara might change that too by implementing open hardware which might work as you wish it too work ! 
Hope I answered what you asked ! And not other thing !

Regards Sanket Shah
Follow my Blog http://sourcex.wordpress.com

Reply all
Reply to author
Forward
0 new messages