- Parser: Itchecks for syntax and semantics. Parser is nothing but a lexical analysis that results into the breaking of code into tokens in order to understand their meanings and these tokens gets converted into Abstract Syntax Tree(AST).
- Abstract Syntax tree: It is a hierarchical tree like structure of program representation which allows interpreter to understand the program. This AST is initially goes to the Interpreter.
- Interpeter: It lets the AST to get converted into Byte code. In V8 engine, this process is known as Ignition but when some code gets repeated again and again.
// Arrow function
const multiply = (a, b)=> a*b;
In the above code, we are calling multiply() function 1000 times. When this code goes into the interpreter, the interpreter performance got decreased, since, Interpreter had to repeat this code again and again and then profiler will mark this code as warm and comes into action.
- Profiler: It will check for the repeating code that can be optimized. As soon as, it gets the repeating code, it basically moves the code into compiler.
The Spider Monkey converts the main JS code into the byte code through the compiler, after that the byte code goes into two section Interpreter and JIT Compiler.
Mozilla’s SpiderMonkey Engine three things are important which are as follows:
- IonMonkey JIT Compiler: It is mainly used for optimization of code.
- Garbage collector: It is used for claiming the memory used by objects that are no longer used by the program. The GC is a mark-and-sweep, non-conservative collector. It is used to hold the JS objects and the string descriptors.
Chrome’s V8 Engine -> 98%
Mozilla’s SpiderMonkey -> 87%
- Use EJS as Template Engine in Node.js
- Search Engine Optimization (SEO) | Basics
- How to detect search engine bots with PHP ?
- Mobile Search Engine Optimization (SEO)
- Elasticsearch Search Engine | An introduction
- Index inside map() Function
- How to dynamically load JS inside JS ?
- CSS | page-break-inside Property
- What purpose does a <script> tag serve inside of a <noscript> tag?
- CSS to put icon inside an input element in a form
- How to vertically align text inside a flexbox using CSS?
- Add the slug field inside Django Model
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.