How it works
Chakra supports a three-tiered architecture. There is a an interpreter focusing on fast start up times, a JIT compiler used to produced highly optimized code, and a garbage collector that reduces pause and improves responsiveness.
Now, we get to the improvements to this flow that Microsoft is working on.
The first is a Simple JIT that accompanies the Full JIT compiler. The JIT compiler produces machine code that runs much faster. However, it takes time to produce this code. So the slower interpreter is running byte code while Chakra waits on the Full JIT. To reduce the time it takes from executing slower byte code to machine code, Microsoft has added the Simple JIT. This will ignore complex optimizations but will produce machine code faster than the full JIT, enabling Chakra to switch from slower byte code to faster machine code earlier. Once the full JIT is finished, the Chakra will switch to that code.
So far, there has been three threads used by Chakra. But some hardware can handle more than this workload. Chakra can now determine when the hardware is capable of more, and then starts multiple threads for JIT compilation. This also decreases the time it takes to switch from slower byte code to faster JIT machine code.
The last improvements come to the JIT compiler itself. So far, I’ve tried to make it as easy as possible to understand for those of you without a technical background, but here it becomes impossible to delve into details. The JIT compiler takes byte code and turns it into machine code that is read by the computer directly. New optimizations make the resulting code more efficient and produce performance boosts when it is run by Chakra.
If your head is already spinning, no worries, this is not easy to follow even for some programmers as it is very low level material.
Note: lead image is just a snippet from the jQuery source code.