首页 > 其他分享 >JIT和AOT的区别

JIT和AOT的区别

时间:2022-11-24 14:34:52浏览次数:35  
标签:code 区别 machine JIT AOT Time compiler

http://net-informations.com/faq/qk/jit.htm

 

Compilers are tools that convert human readable text into machine code. The terms Ahead-of-Time (AOT) and Just-in-Time (JIT) refer to when compilation takes place: the "time" referred to in those terms is "runtime", i.e. a JIT compiler compiles the program as it is running, an AOT compiler compiles the program before it is running.

faster

In theory, a Just-in-Time (JIT) compiler has an advantage over Ahead-of-Time (AOT) if it has enough time and computational resources available. A JIT compiler can be faster because the machine code is being generated on the exact machine that it will also execute on. This means that the JIT has the best possible information available to it to emit optimized code.

optimization

JITs can in fact do some optimizations that Ahead-of-Time (AOT) compilers cannot. With a traditional compiler/optimization system, you have to guess which parts are important. With a Just-in-Time (JIT) optimization, you can first measure which parts are actually used, and optimize that. This means that JIT will compile only those parts that user care about, leaving potentially 80% of code untouched, saving time and memory. If you pre-compile bytecode into machine code, the compiler cannot optimize for the target machine(s), only the build machine.

platform-specific

Because the JIT-compilation takes place on the same system that the code runs, it can be very, very fine-tuned for that particular system. If you do Ahead-of-Time (AOT) compilation (and still want to ship the same package to everyone, in this case you have to compromise.

run-time metrics

A JIT-compiler can not only look at the code and the target system , but also at how the code is used. It can instrument the running code, and make decisions about how to optimize according to, for example, what values the method parameters usually happen to have.

Disadvantages

  1. Large applications generally benefit from being compiled ahead-of-time, but small ones generally don't

  2. Native images load faster because they don't have much startup activities, and require a static amount of fewer memory (the memory required by the JIT compiler).

标签:code,区别,machine,JIT,AOT,Time,compiler
From: https://www.cnblogs.com/tangjicheng/p/16921728.html

相关文章

  • css px em rem % vw vh vm 区别
    前言在传统项目开发中,我们只会用到px、%、em这几个单位长度,它们可以适用大部分项目的开发,并且拥有较好的兼容性。而从css3开始,浏览器对逻辑单位的支持又提升了新的境......
  • javascript:void() 和 herf="#" 区别
    javascript:void(0)和herf="#"区别本文内容参考菜鸟教程(大部分都是原文内容)原文地址javascript:void(0)的含义我们经常会使用到javascript:void(0)这样的代码......
  • JSON.parseObject与JSONObject.parseObject的区别
    JSON和JSONObject先看一下源码JSON源码publicabstractclassJSONimplementsJSONStreamAware,JSONAware{publicstaticJSONObjectparseObject(Stringtext){......
  • import和export的用法及动态引入和静态引入的区别
    本文转载自https://www.ucloud.cn/yun/104458.html摘要:命令用于规定模块的对外接口,命令用于输入其他模块提供的功能。前者用于服务器,后者用于浏览器。命令接受一对大括号......
  • @NotBlank @NotNull @NotEmpty三个注解的区别
    @NotBlank字符串不能为null和空字符串""@NotNull字符串不能为null@NotEmpty集合类型集合长度不能为0在写参数校验类的时候遇到的注解 ......
  • vue3和vue2 的区别,vue3和vu2到底哪个好呢?
    vue3正式发布有两年多了,之前也做过一些学习和研究。vue3发布后给某培训机构开发了一套vue3课程课件,自己也开源了一套基于vue3的后台管理系统(因为个人懒的原因,半年后才上......
  • md5和AES有什么区别,各自有什么优势特点
    md5和AES经常应用于信息安全领域,这两者虽然都是常用的算法,但是它们之间却有着很大的区别。简单来说,md5不是加密算法,AES是对称加密算法。那么,md5和AES具体有哪些区别,各自又......
  • md5和AES有什么区别,各自有什么优势特点
    md5和AES经常应用于信息安全领域,这两者虽然都是常用的算法,但是它们之间却有着很大的区别。简单来说,md5不是加密算法,AES是对称加密算法。那么,md5和AES具体有哪些区别,各自又有......
  • isBlank、isEmpty的关于String字符串进行判空的区别(源码角度分析)
    现在判空一般都用StringUtils这个工具类,是apache.lang包下面的一般是isBlank用的会多一点但是我们先看看isEmpty()的源码1publicstaticbooleanisEmpty(finalCharS......
  • Python-import xx 和 from xx import xx 的区别
    1.importxx:导入模块,在使用的时候需要“模块.函数”来使用例如:1importmath2math.sqr(5)  2.fromxximportxx和fromxximport*这两个本质没有区......