JIT compiler vs offline compilers
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.
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.
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.
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.
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.
- Large applications generally benefit from being compiled ahead-of-time, but small ones generally don't
- 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).
- Does C# support multiple Inheritance ?
- What is Process ID ?
- How do I make a DLL in C# ?
- How many ways you can pass values to Windows Services ?
- Can we use "continue" statement in finally block ?
- What is nullable type in c# ?
- Difference between the Debug class and Trace class ?
- What is lock statement in C#
- What are dynamic type variables in C#
- What is the difference between is and as operator in C#?
- What are circular references in C#?
- What are the differences between events and delegates in C#
- Explain the types of unit test cases in C#?
- How many types of comments are there in C#?
- What are the various ways to pass parameters to a method in C#?
- What are the different ways to deploy a assembly in net?
- What does assert() method do in c#
- What is literals in C# - Constants and Literals
- What is the use of goto statement in C#
- Why events have no return types in .NET
- What's the difference between a static method and a non-static method in C#
- What's a weak reference c#?
- What is C# equivalent of the vb.net isNothing function
- What are indexers in C#
- What are generics in c#