Which solution is right for your business?
05 June 2024
V8, el motor de código desarrollado por Google
Javascript has become the most important programming language in the world of web development; it allows us to create a web application using this same language not only to develop the front-end of the site, but also the back-end.
It is now a recurring event to hear news reporting on new libraries or frameworks dedicated to improving or expanding the functionality of Javascript.
Therefore, in 2008, coinciding with the launch of the most used browser today: Google Chrome, Google created its own Javascript code interpreter and called it V8.
But, how does this work and why does a browser require an interpreter?
Well; when accessing a website from a browser, it requires downloading all the .js files to have an understanding of all the instructions to execute. For this, and since browsers only understand instructions in machine code, it requires an interpreter system that can "translate" all these instructions so they can be understood and then executed by the browser.
So, the one responsible for interpreting Javascript code instructions in Google Chrome and employing processes known as JIT Compiler is the V8 Engine.
V8 Engine currently, and due to its great stability, has become the most reliable Javascript code conversion engine developed in C++, used in tools like Microsoft Edge, Chrome, and NodeJS.
Google's V8 engine converts Javascript instructions into a list of tokens, which will later produce an Abstract Syntax Tree, representing the source code written in Javascript (in this case) in a simplified tree structure. After this, it will go through the interpreter, which will generate Bytecode and then interpret this Bytecode to execute it. It also features optimization from its compiler called TurboFan, whose main task is to take processed and returned instructions from the interpreter to compile them for the target.
It is also worth mentioning that starting from Chrome 66, V8 compiles the JavaScript source code in a background thread, reducing the amount of time spent compiling on the main thread by 5% to 20%.
In this way, it revolutionizes the way Javascript is processed, allowing it to be executed much faster by using an interpreter to transform the code and later a compiler to optimize the final result.
Share