Read: Top 10 AngularJS Alternatives
Let’s start by understanding the differences between a compiler and an interpreter. As web developers might know, a computer can only understand 0s and 1s (think of them as simple on/off switches). This is why every computer program must eventually be converted into machine code. This task is performed using a process called compilation or interpretation. We examine each of these processes in the next section.
What is compilation in programming?
During compilation, the entire source code is converted into machine code at once. Machine code is written in a portable file that can be run anywhere, regardless of platform or operating system. There are two steps involved in the code compilation process. In the first stage the machine code is built and in the second stage it is executed on the machine.
Execution of machine code occurs right after compilation. For example, any application that you currently use on your computer has been compiled first and you can now run it on your machine.
What is interpretation in programming?
On the other hand, while interpreting, the interpreter goes through the source code and executes it line by line. Unlike compilation, which involves a two-step process, in interpretation the code is read and executed at the same time. Of course, the source code still needs to be converted into machine language, but the code conversion does not happen in advance, but rather just before execution.
What is just-in-time compilation?
How does just-in-time (JIT) compilation work?
Here we have declared a constant variable with name val and gave it the value 45. As you can see from the AST tree side, besides the declaration there is a lot of extra code. Can you imagine all the superfluous code that would be generated in a large application?