Part 03 - JavaScript Engines and Runtime Environment
Part 03 - JavaScript Engines and Runtime Environment
When you run JavaScript code in a browser, it doesn’t interact directly with our
computer’s hardware. Instead, it communicates with the JavaScript engine, which
serves as a bridge between our code and the underlying machine.
● High performance
● Written in C++
● JIT compilation
● Written in C++
● Development Focus:
● V8: High-performance web applications and server-side JavaScript.
● Scope Chain: Contains the current execution context's Variable Object and its
parent execution contexts.
● Optimization Strategies:
● Defer or async attributes (for external scripts)
● Changing styles
● Optimization Strategies:
● Efficient DOM manipulation
● Batch DOM updates
● Use of virtual DOM in frameworks
11/25/2024 Dr. Amjad AbuHassan 38
JavaScript Execution and the Main Thread
● Main Thread: Executes JavaScript and handles rendering.
● JavaScript Impact:
● Blocking the main thread
● Delaying rendering
● Optimization Strategies:
● Use Web Workers