ART内的apk的安装过程。从Dalvik虚拟机安装过程的区别 [英] Installation process of .apk within ART. Difference from Dalvik VM installation process

查看:1131
本文介绍了ART内的apk的安装过程。从Dalvik虚拟机安装过程的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我回答<一个href=\"http://stackoverflow.com/questions/30358687/how-are-android-applications-facebook-etc-installed-to-an-android-phone\">this问题,其中被描述 .apk文件文件的整个安装过程到Android手机。有一件事是关于使用 Dalvik虚拟机。现在我不知道是在安装过程中使用 ART 是完全一样?有什么区别?
我的意思的软件包管理系统路径皈依到 DEX 格式的等工作
谷歌搜索没有给出太多信息,只有高性能电源,管理内存和类似的东西。
我会非常感激,如果有人用知识可以共享这些信息。

Recently I answered this question, where was described whole installation process of .apk file to android phone. The one thing it was about using Dalvik VM. And now I'm wondered is installation process is exactly same using ART? What are the differences? I mean the work of PackageManager, path, convertion to dex format etc. Googling didn't give much info, only about performance power, managing memory and something similar. I would be very thankful if someone with knowledge could share this information.

推荐答案

Android应用走在了 .apk文件文件格式,与Java类转换成 DEX 字节code。在 DEX 字节code格式是独立的设备架构,需要转换为本地机器code到设备上运行。这对于在 ART 的Dalvik 运行时是一样的。

Android apps come in the .apk file format, with Java classes converted into DEX bytecode. The DEX bytecode format is independent of device architecture and needs to be translated to native machine code to run on the device. This is the same for both the ART and the Dalvik runtimes.

的Dalvik ART 最显著的变化是,的Dalvik 基于 刚刚在时间 JIT )的编译,而 ART 基于 名列前茅的时间 AOT )的编译。

The most significant change from Dalvik to ART is that Dalvik is based on Just-in-Time (JIT) compilation, while ART is based on Ahead-of-Time (AOT) compilation.

随着的Dalvik JIT编译器的,每时,应用程序运行时,它会动态地转换了的Dalvik 字节code的一部分为机器code。随着执行的进行,更多的字节code编译和缓存。另一方面,技术装备有超前 - 的时的编译器。在应用程序的安装阶段,其静态转换的 DEX 字节code成机器code和存储在设备的存储。这是当安装在设备上的应用程序这恰好是一次性事件。

With the Dalvik JIT compiler, each time when the app is run, it dynamically translates a part of the Dalvik bytecode into machine code. As the execution progresses, more bytecode is compiled and cached. On the other hand, ART is equipped with an Ahead-of-Time compiler. During the app’s installation phase, it statically translates the DEX bytecode into machine code and stores in the device’s storage. This is a one-time event which happens when the app is installed on the device.

性能

Performance

ART 运行时间超过 Dalvik的最重要的好处运行时,该应用程序运行在<$ C $更快C> ART 。由于在安装过程中 DEX 字节code已被翻译成机器code,没有多余的时间,需要在运行时进行编译。该应用程序启动速度更快,以及当 ART推出出于同样的原因。

The most important benefit of ART runtime over Dalvik runtime is that the app runs faster on ART. Because DEX bytecode has been translated into machine code during installation, no extra time is needed to compile it during the runtime. The app starts faster as well when launched with ART for the same reason.

由于的Dalvik 需要 JIT code高速缓存的额外内存,应用程序占用更小内存占用,当它运行在 ART

Because Dalvik requires extra memory for JIT code cache, an app occupies a smaller memory footprint when it runs on ART.

电池寿命

Battery Life

使用 Dalvi K运行时, JIT 编译 CPU 的约束。因为 AOT 编纂, ART 从翻译 DEX 字节code机器code中的应用程序的执行过程中,从而降低了能耗。使用 ART 导致更长的电池寿命,这是需要一个电池充电时的时间间隔。

With Dalvik runtime, the JIT compilation is CPU bound. Because of AOT compilation, ART frees the CPU from translating DEX bytecode to machine code during the app’s execution, thus reducing energy consumption. Using ART leads to a longer battery life, which is the time interval when a battery recharging is needed.

安装时间

Installation Time

由于该 AOT 编译器将 DEX 字节code成机器code中的应用程序安装过程中,一个应用程序需要更长的时间与 ART 运行在设备上安装。考虑到更快的执行,我们在previous节讨论短的启动时间,其应用程序的安装过程中只发生一次这个额外的时间,带来的好处是值得的。

Because the AOT compiler translates DEX bytecode into machine code during the app installation, an app takes longer to install on a device with ART runtime. Considering the benefits of faster execution and shorter launch time we discussed in the previous section, this extra time which happens only once during the app’s installation is well worth it.

存储空间

Storage Footprint

使用 ART 运行时, AOT 编译器把应用程序的 DEX 字节code成机器code,并将其存储在设备的存储空间。在pre-编译的二进制占据比DEX字节code更多的空间。因此,会产生较大的存储空间与的Dalvik 运行。

With ART runtime, the AOT compiler translates the app’s DEX bytecode into machine code and stores it in the device’s storage. The pre-compiled binary occupies more space than the DEX bytecode. Thus results in a larger storage footprint comparing with Dalvik runtime.

摘要

Summary

对于这一点,我们已经推出了针对Android新 ART 运行。我们还讨论了它的好处和妥协,在名列前茅的时间汇集和性能改进集中。目前发布了preVIEW,并且仍然在积极的开发和优化,在这一点的时候,我们不能提供多少性能的定量结论,通过切换到 ART运行上涨。有一点肯定是ART将取代的Dalvik 作为Android的运行时间上的 86 基础的设备。

To this point we have introduced the new ART runtime for Android. We also discussed its benefits and compromises, centralizing in its Ahead-of-Time compilation and performance improvement. Currently released for preview and still under active development and optimization, at this point of time we cannot provide a quantitative conclusion on how much performance gained by switching to ART Runtime. One thing for sure is ART will replace Dalvik as the Android runtime on the x86 based devices.

<一个href=\"https://software.intel.com/en-us/blogs/2014/06/18/art-vs-dalvik-introducing-the-new-android-x86-runtime\"相对=nofollow>来源。

这篇关于ART内的apk的安装过程。从Dalvik虚拟机安装过程的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆