订了个计划,极可能每日翻译一篇英文文档。 优质的英文源不好找,想到Quora.com上面有很多不错,就暂时先用这个来做吧。
Why is ART better than Dalvik?
为什么 ART 比 Dalvik 更好?
ART(Android RunTime) is the next version of Dalvik. Dalvik is the runtime, bytecode, and VM used by the Android system for running Android applications.
ART 是Dalvik的下一代版本,Dalvik 是安卓系统运行的 应用的 一个虚拟机。Dalvik是 运行时,和 字节码。
ART has two main features compared to Dalvik:
ART比较 Dalvik 有两个主要功能。
Ahead-of-Time (AOT) compilation, which improves speed (particularly startup time) and reduces memory footprint (no JIT)
AOT 编译,可以提高速度(特别是启动时间) 和 减少内存足迹(不是 JIT )
Improved Garbage Collection (GC)
改进 内存回收(GC)
AOT means your apps are compiled to native code once. What is stored on your phone and run is effectively native, not bytecode. This differs from the traditional VM model, which interprets bytecode. Interpreters are slow, so VM developers added a technology calledJust-in-Time(JIT) compilation, which compiles (and hopefully optimizes) your code to native code on-the-fly. Dalvik is a JIT'ing VM. The downside to JIT is that the JIT compiler runs while you are using your app, adding latency and memory pressure. The upside is that the JIT compiler can look athowyou are using your code to perform profile-directed optimizations.
AOT 意味着 一旦你的APP被编译成原生代码,那么存储在手机或者运行的时候实际上都是原生的,不是字节码。传统的虚拟机模型 处理上是使用解释 字节码,然后解释器运行时 比较慢的,因此 虚拟机 开发者,加入一个技术 Call/Just-In-Time(JIT)编译。JIT 可以快速 编译 (和希望 优化) 你的代码成原生的代码。Dalvik 是一种 JIT 同时进行的Vm。JIT的 最差表现是 进行JIT编译的同时运行 你的APP,会有附加延迟和内存压力。最佳性能是 JIT 编译器可以 查找 你 如何使用你的代码,来 执行 面向概要的 优化。
AOT is like JIT, but it runs once—say, at app installation time. While it lacks the ability to perform profile-directed optimizations, it is possible to perform more extensive optimizations since the compilation is less time sensitive. AOT is useful on systems, such as mobile devices, where JIT adds an unacceptable latency or memory cost to running apps. I think AOT is the right step for Android and ART looks quite impressive.
AOT 像JIT,但是 它一旦 运行(就是,APP 安装的时候)。虽然 他缺少执行 面向概要的 优化,但是他可以执行更加广泛的优化,因为编译器有更多的时间来处理(对时间不敏感)。AOT 对 一些系统 有用(比如 手机设备),在这些系统上,JIT 可能会 增加 不可接受的延迟 和内存消耗来运行APP。我认为 AOP 是 安卓 做的正确 优化(步骤),ART看起来令人印象深刻。
ART was first included inAndroid KitKat, but isn't yet enabled by default. You can enable it viaSettings>Developer options>Select runtime>Use ART.
ART 第一次是被 Android Kikat 引入,但是 默认 没有启用。 你可以启用它通过 设置-》 开发者选项=》 选择运行时=》 使用ART
网友评论