dexopt和dex2oat之间的区别? [英] Difference between dexopt and dex2oat?

查看:7133
本文介绍了dexopt和dex2oat之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌的Dalvik 移动到 ART ( Android运行)。

我是想明白了,这是怎么回事,以提高性能。

我找到的最好的解释是下面的图片:

一个已经改变的主要成分是 dexopt dex2oat

由于我没有这些想法很多,谁能解释的差异,这是怎么回事,以提高性能?​​

解决方案

dexopt确实在DEX文件中的一些优化。它类似与被称为是一个优化的版本,其包括该方法的V表索引取代的虚拟调用指令,因此,它不必执行期间执行一个方法查找

dexopt的结果是一个ODEX(优化DEX)文件。这非常类似于原始文件塞米松,不同之处在于它使用了一些优化运算codeS,象优化调用虚拟指令

dex2oat需要一个DEX文件,并对其进行编译。其结果是本质上,然后执行本地ELF文件。而不必字节code是由虚拟机PTED除$ P $所以,它现在已经可以通过本机的处理器执行本地code。这就是所谓的AOT(提前- - 时间)编制。

另一个因素要考虑的是,Dalvik的使用JIT(刚刚好时间)编译器 - 这意味着它也能够编译字节code到本机code。主要的区别不过是,ART编译一切时间提前,而Dalvik的只有编译使用启发式检测是最频繁执行的code中的字节code的一个子集,并在执行过程中它编译。<​​/ P>

Google is moving from Dalvik to ART(Android Runtime).

I was trying to understand, how it is going to improve the performance.

The best explanation I found is the below image:

One of the main component which has changed is dexopt to dex2oat.

Since I don't have much idea about these, can anyone explain the difference and how this is going to improve the performance?

解决方案

dexopt does some optimizations on the dex file. It does things like replacing a virtual invoke instruction with an optimized version that includes the vtable index of the method being called, so that it doesn't have to perform a method lookup during execution.

The result of dexopt is an odex (optimized dex) file. This is very similar to the original dex file, except that it uses some optimized opcodes, like the optimized invoke virtual instruction.

dex2oat takes a dex file and compiles it. The result is essentially an elf file that is then executed natively. So instead of having bytecode that is interpreted by a virtual machine, it now has native code that can be executed natively by the processor. This is called AOT (ahead-of-time) compilation.

Another factor to take into account is that dalvik used a JIT (just-in-time) compiler - meaning that it was also able to compile bytecode to native code. The main difference however, is that ART compiles everything ahead of time, whereas dalvik only compiled a subset of the bytecode using heuristics to detect the code that was executed most frequently, and it compiled during execution.

这篇关于dexopt和dex2oat之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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