转自:

http://en.wikipedia.org/wiki/AOT_compiler

https://wiki.gnome.org/Vala/FAQ#How_does_the_performance_of_Vala_applications_compare_to_other_applications.3F

Anahead-of-time (AOT) compileris acompilerthat implements ahead-of-time compilation. This refers to the act of compiling an intermediate language, such asJava bytecode, .NETCommon Intermediate Language(CIL), orIBM System/38orIBM System i"Technology Independent Machine Interface" code, into a system-dependent binary.

AOT(ahead-of-time 编译方式),就是将 像Java编译后得到的中间语言文件 变成和系统相关的 native binary。

Most languages with amanaged coderuntime that can be compiled to an intermediate language take advantage ofjust-in-time(JIT)[citation needed]. This, briefly, compiles intermediate code intomachine codefor a native run while the intermediate code is executing, which may decrease an application's performance. Ahead-of-time compilation eliminates the need for this step by performing the compilation before execution rather than during execution.

JIT(just-in-time),相当于解释型语言,运行的时候,相当于是解释一条语句执行一条语句,即将一条中间的托管的语句翻译成一条机器语句,然后执行这条机器语句。执行效率较低。

相比JIT,AOT在运行之前就将中间托管代码翻译成了机器代码,不存在JIT的“执行期的翻译”步骤,所以执行效率比JIT高。

AOT compilation is mostly beneficial in cases where theinterpreter(which is small) is too slow orJITis too complex or introduces undesirable latencies.[citation needed]In most situations with fully AOT compiled programs and libraries it is possible to drop considerable fraction of runtime environment, thus saving disk space, memory and starting time. Because of this it can be useful in embedded or mobile devices.

AOT主要适用场合是,当解释器(中间语言翻译成机器语言)速度太慢,或JIT过于复杂,或JIT导致严重的滞后的情况。大多数情况下,启用了AOT以后的可执行程序,相比启用AOT之前,可以摒弃很多运行时环境的碎片(fraction of runtime environment),从而节省磁盘/内存空间,缩短启动时间。因此,AOT在嵌入式设备和移动设备中是很有用的。

AOT in most cases produces machine optimized code, just like a 'standard' native compiler. The difference is that AOT transforms the bytecode of an existing virtual machine into machine code. AOT compilers can perform complex and advanced code optimizations which in most cases of JITing will be considered much too costly. On the other hand AOT can't usually perform some optimizations possible in JIT, like runtimeprofile-guided optimizations, pseudo-constant propagationor indirect/virtual functioninlining.

大多数情况下,AOT都可以将二进制代码针对硬件做优化,这时的AOT就很想一个真正的本地编译器,比如gcc。AOT和真正的本地编译器的不同之处在于,AOT是将现有的虚拟机的字节码转成本机二进制码,即操作对象和真正的编译器不同。AOT编译器可以执行高级的复杂的字节码的优化,这些优化对JIT来说,大多数都代价太高。另一方面,通常AOT不能执行一些JIT能做到的优化,比如 runtimeprofile-guided optimizations, pseudo-constant propagationor indirect/virtual functioninlining。

How does the performance of Vala applications compare to other applications?

The performance should be pretty similar to GObject/C-based code as there is no Vala-specific runtime library/environment that needs to be loaded. The C compiler can also apply the same optimizations on Vala-generated C code and plain GObject/C code. The Vala compiler uses reference counting in more places than most GObject/C-based applications do. However, Vala allows to fine-tune that easily in performance-critical sections with the weak modifier.

Vala application和其他语言的application的执行效率的比较

Vala application的执行效率类似GObject/C-based 代码的执行效率,因为Vala没有自己额外的运行时库和运行时环境要加载。C编译器可以对用Vala生成的C代码或GObject/C代码做相同的优化。Vala编译器在大多数情况下比GObject/C-based applications使用更多的引用计数。但是,Vala允许对“性能敏感”的部分通过weak modifier做微调。

AOT/JNI/Vala 的比较相关推荐

  1. 【Flutter】Dart 语言 ( Dart 语言特征 | JIT 即时编译 | AOT 静态编译 )

    文章目录 I . Dart 语言特征 II . JIT 即时编译 III . AOT 静态编译 I . Dart 语言特征 1 . Dart 语言特征 : ① 语言类型 : 强类型语言 ; ② 编译类 ...

  2. 听说这样学JNI,效果不是一般的好

    二手程序员的博客地址: https://lyldalek.top/ JNI定义 JNI全称:Java Native Interface.它是Java本身的一种特性,用来在Java里面调用C/C++代码 ...

  3. Java在云原生的破局利器——AOT(JIT与AOT)

    导读 JIT(Just-in-Time,实时编译)一直是Java语言的灵魂特性之一,与之相对的AOT(Ahead-of-Time,预编译)方式,似乎长久以来和Java语言都没有什么太大的关系.但是近年 ...

  4. eclipse调用JNI之环境的搭建

    因为项目中要在Java中调用C++编好的代码,即用eclipse调用动态链接库,故花了点时间研究在eclipse中使用JNI. 有时候因为Java本身特性的限制,单独使用Java语言可能不能完全满足应 ...

  5. [转]Android JNI使用方法

    本文转自:http://www.open-open.com/lib/view/open1324909652374.html 经过几天的努力终于搞定了android JNI部分,下面将我的这个小程序和大 ...

  6. android studio 自动提示jni代码,如何将JNI(C/C++本机代码)添加到现有的Android Studio项目中...

    从现有项目中执行以下步骤: 1.修改build.gradle(模块应用程序)看起来像这样(很多变化!): apply plugin: 'com.android.model.application' m ...

  7. java 清空控制台_利用原生库和JNI(Java原生接口)实现H2数据库漏洞利用

    在H2数据库引擎中获取代码执行权限的技术早已是众所周知,但有个要求就是H2能够动态编译Java代码.而本文将向大家展示以前没有公开过的利用H2的方法,并且无需使用Java编译器,即通过原生库和JNI( ...

  8. idea java jni 调试_IntelliJ IDEA平台下JNI编程(一)—HelloWorld篇

    JNI(Java Native Interface),出于学习JNI的目的,为了能够更方便快速地运行程序.本文的是在IDEA中进行,而不在AndroidStudio,这样能够对NDK的工作过程有个更深 ...

  9. Android:JNI 与 NDK到底是什么

    前言 在Android开发中,使用 NDK开发的需求正逐渐增大 但很多人却搞不懂 JNI 与 NDK 到底是怎么回事 今天,我将先介绍JNI 与 NDK & 之间的区别,手把手进行 NDK的使 ...

最新文章

  1. 阿里AI labs发布两大天猫精灵新品,将与平头哥共同定制智能语音芯片
  2. 如何利用大数据做金融风控? 原创 2016年11月24日 17:42:03 标签: 大数据 / 金融 / 风控 1594 导语:如何通过海量数据与欺诈风险进行博弈? 随着金融科技、科技金融等概念的
  3. ado.net连接mysql 类_C# ADO.NET 连接数据库常用到的类及基本操作格式
  4. 史上最全的CSS hack方式一览
  5. 无招胜有招之Java进阶JVM(七)对象模型
  6. 使用Helm将ASP.NET Core应用程序部署到Kubernetes容器集群
  7. pl/postgresql_将PostgreSQL PL / Java安装为PostgreSQL扩展
  8. 微信小程序图片选择,预览和删除
  9. iOS开发证书和配置文件的使用
  10. 计算机安全覆盖的内容有哪些,计算机网络的分类有哪些
  11. IIS 故障一例(XP更新补丁后)
  12. 交错数组(jagged array)
  13. logistic回归模型
  14. 全平台视频转GIF软件对比与推荐(iOS/安卓/Windows/Mac)
  15. 如何用PHOTOSHOP倒置文字?
  16. java正则顿号怎么表示_3正则表达式3
  17. 126邮箱stmp服务器,免费邮箱
  18. MySQL的刷脏页策略
  19. 图神经网络和强化学习
  20. 运营之光2我的互联网运营方法论与自白

热门文章

  1. ASW3410 10GHz/USB3.1高速模拟切换芯片规格分享完美代替ONSEMI安森美FUSB340
  2. 人力资源行业发展历程
  3. 【Excel】VLOOKUP使用后出现#SPILL!是怎么回事?
  4. framework 窗口动画缩放修改(Android 10)
  5. 自媒体入门必备的10个工具,一定要收藏起来
  6. html5前端开发的干货模板“text/tpl” script template
  7. sklearn的随机森林实现泰坦尼克号旅客生存预测
  8. 单片机C51期末复习题,文末附答案
  9. html footer写法,HTML5 footer标签元素 css3布局教程
  10. RCE 远程命令代码执行漏洞