Microsoft optimizes JavaScript execution in Internet Explorer for Windows 10 Technical Preview

Reading time icon 4 min. read

Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Microsoft optimizes JavaScript execution in Internet Explorer for Windows 10 Technical Preview

We recently wrote about the advances in JavaScript performance in Internet Explorer in the Windows 10 Technical Preview. Today Microsoft has revealed more details into the areas they are targeting.

Chakra is the JavaScript engine that interprets JavaScript code into functionality in Internet Explorer 9 and up.

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.

Once Chakra gets JavaScript code from an app or website it checks it for any syntax errors, which are statements that violate language rules. When a function is executed Chakra creates an abstract syntax tree (which is the source code represented in a tree data structure). This is used to make byte code (non-human readable code used by interpreters for languages such as Java and Python also). This is interpreted immediately (the browser is acting upon the code) while the JIT Compiler creates more optimized machine code by collecting data. It also optimizes loops, parts of code that are being run multiple times, so that it is not reading them over and over. Once the JIT compilation is complete, every time the function is called, Internet Explorer will run the faster machine code, rather than interpreting the slower byte code.

This is a simplified version of the process, but now you have a general understanding of what happens to JavaScript code in Internet Explorer. Here is a diagram for a visual recap.

Chakra’s JavaScript execution pipeline

New Optimizations

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.

Here is a “tl;dr”– JavaScript is an ‘interpreted’ language, which means that it requires a program to read and execute its instructions. Other languages like C++ are ‘programed,’ which means they are compiled into machine code that the computer directly understands. In fact, the program that reads interpreted languages is usually written in programming languages such as C++. What Chakra does is read and execute JavaScript while producing faster machine code for it. The optimizations are aimed at transitioning to this machine code as fast as possible, and making the machine code more efficient.

Note: lead image is just a snippet from the jQuery source code.