Nov 18, 2010 0 comments
Just in Time (JIT)
JIT is responsible for converting the managed code into machine code. It is a part of the runtime execution environment.
JIT known as dynamic translation is a technique for improving the runtime performance of a computer program.
JIT builds upon two earlier ideas in run-time environments:
- Byte code compilation
- Dynamic compilation.
It converts code at runtime prior to executing it natively, for example byte code into native machine code.
The performance improvement over interpreters originates from caching the results of translating blocks of code, and not simply reevaluating each line or operand each time it is met.
It also has advantages over statically compiling the code at development time, as it can recompile the code if this is found to be advantageous, and may be able to enforce security guarantees.
Thus JIT can combine some of the advantages of interpretation and static compilation.
Several modern runtime environments, such as Microsoft's .NET Framework and most implementations of Java and most recently Action script 3, rely on JIT compilation for high-speed code execution
JIT are of three types :
- Pre JIT
- Econo JIT
- Normal JIT
1. Pre JIT : Compiles entire code into native code at one stretch
- It converts all the code in executable code
- it is slow
- It compiles complete source code into native code in a single compilation cycle.
- This is done at the time of deployment of the application.
2. Econo JIT : Compiles code part by part freeing when required
- It will convert the called executable code only.
- it will convert code every time when a code is called again.
- It compiles only those methods that are called at runtime.
- these compiled methods are removed when they are not required.
- This compiler converts the MSIL code into native code without any optimizations
3. Normal JIT Compiles only that part of code when called and places in cache
- It will only convert the called code
- It will store in cache so that it will not require converting code again.
- Normal JIT is fast.
- Compiles only those methods that are called at runtime.
- These methods are compiled the first time they are called, and then they are stored in cache.
- When the same methods are called again, the compiled code from cache is used for execution.