首页 > 代码库 > Android:What is ART?
Android:What is ART?
背景:Android4.2之前,安卓手机系统的应用程序均在Dalvik Java的虚拟机上运行,这种运行模式还要依靠一个编译器来实现与应用程序的沟通。应用程序每次运行时,都需要将程序内的代码转变为机器码才能运行,这无形中多附加了一道手续,这就造成了手机耗电相对较快,占用内存大,用久了会卡顿的现象。
前言:KitKat(奇巧巧克力):雀巢的巧克力棒产品,最近Google宣布最新4.4版Android将命名为"KitKat"
One of the greatest features of Android 4.4.x KitKat, also probably the most under-reported one, is the next generation Android RunTime (ART).
翻译:Android4.4.x KitKat 最显著的特征之一就是下一代的Android Run Time(ART),或许也是下一个即将被广为关注的特征What is ART?
翻译:什么是ART? (艺术)
When you start any apps on your Android device, the system actually takes some time and effort to compile the app package to machine code so your device can understand and execute. It does this Just in Time of execution. So as you run apps on your device, it actually keeps doing these resource intensive tasks in the background and this is a major reason why people notice Android apps are a bit sluggish when compared to their iOS counterparts.
翻译:当你在你的Android设备上启动任意app程序,系统都会耗费一些时间和精力(资源)去把该app包文件编译成机器码,以便你的设备可以理解并运行。这个过程在程序运行时执行。所以当你在你的设备上运行你的app程序,事实上,在后台也同时运行着这些很耗费资源的任务。这也是和苹果IOS系统相比,在Android系统上运行app程序会让人感觉的有些缓慢的主要原因。This is, until you switch to the new Android RunTime (ART).
翻译:这个问题会一直存在,除非你换到新的Android Run Time。
With ART enabled, machine code compilations are done Ahead of Time during app installation. So when you run apps on your device, it can skip all that and simply executes the code directly.翻译:在ART启用的情况下,机器码的编译会在app程序安装过程中提前编译完成。这样当你在你的设备上运行你的app程序,它可以跳过编译的过程,直接运行编译好的机器码。
The result? Reports show that ART yields performance improvements of around 10% to 20% on average. On the other hand it also boosts battery life because your device now does a lot less resource intensive machine code compiling. Take into considerations ART is currently a preview technology in Android 4.4.x KitKat so it can only get better and better in upcoming Android releases.
翻译:这样做的结果是什么呢?报告显示ART使得操作性能平均提高10%到20%。而另一方面,这也延长了电池的使用时间。因为现在你的设备大大减少了执行编译机器码这一耗费资源的行为。考虑到ART目前只是运用在Android4.4.X KitKat版本上,因此在未来发布的Android版本中ART只会越来越好。
英文原文截取自: http://www.mobilehiddencamera.com/
翻译时间:2014年6月23日