Now, let's focus on one of Node.js's best friends, the V8 Engine. It takes the code and runs it. Before doing anything, I just want you to read this carefully.
Alright, let’s move on to the session now. When the V8 engine processes the code, it happens in a few steps:
An interpreter reads and executes code line by line, while a compiler reads the entire code, compiles it, and then passes it to the engine for execution. JavaScript uses both a compiler and an interpreter to run the code, along with several optimizations like JIT (Just-in-Time Compiler).
I highly recommend reading Scope and Closures by Kyle Simpson to dive deeper into these concepts. I am covering digital notes of these books seeding soon in the garden here. The compiler used by V8 is called Turbofan, and its job is to optimize the code so that it runs faster, especially if the same section of code is executed multiple times.
Also, remember that Garbage Collection happens in parallel to free up memory. Below, I’ve listed the names of some garbage collectors used in the V8 engine—make sure to look them up and read about them.
https://medium.com/dailyjs/understanding-v8s-bytecode-317d46c94775
And thats all for this session, I'm Ashutosh Anand Tiwari, and I'm writing digital notes on Node.js. If you enjoy these notes, please share them with your friends. If you find any errors or have improvements, feel free to contribute by clicking edit icon on top bar of this page. If you're interested in writing the next episode's notes, visit this link. Let's learn together! Also, please consider giving a star to this repo. For any queries, let's connect here. Thank you…
Thank you so much for reading. If you found it valuable, consider subscribing for more such content every week. If you have any questions or suggestions, please email me your comments or feel free to improve it.
I'm Rahul, Sr. Software Engineer (SDE II) and passionate content creator. Sharing my expertise in software development to assist learners.
More about me