
Developer from India.
Search for a command to run...

Developer from India.
No comments yet. Be the first to comment.
How I scaled a simple crawler into a "Staff-Level" automated research assistant by overcoming flaky inputs, hardware limits, and API rot. As engineers, we are expected to stay on top of everything: Netflix’s latest architecture, AWS updates, Go 1.23...

A deep dive into scaling, reliability, and system design

Introduction Load balancers are fundamental to distributed systems. They determine how evenly traffic is distributed, how failures are handled, and how fast your service can grow. Over a weekend, I built a lightweight but production-style load balanc...

“Every simple system starts as a toy and evolves into infrastructure. The art lies in knowing when to evolve.” 🧭 Why This Article Exists Most system design discussions about URL shorteners stop at “put a DB behind an API.”This piece goes all the w...

TL;DR We had a subtle but critical payroll bug: deductions were getting silently dropped due to timezone mismatches between us (Rippling) and a partner system (Employee Navigator). What looked like a simple effective_date == pst_now() check turned in...

In the previous writeup, while discussing the features of JS we read how Javascript is a 'Just-In-Time Compiled' language. In this section, we are going to dig deeper into the nuances of this particular feature.
Interpretation languages are executed line by line. Thus, if there's an error at line 19, nothing is stopping the execution from lines 1 to 18. A typical interpretation flowchart looks as follows:

In the early days of the language, Java-script like other scripting languages, like PERL or even Python, used to be interpreted. Interpreted languages are quite poor in performance, and as Javascript's prevalence across the web increased, the poor performance simply became unacceptable(Imagine you waiting for 2 seconds for the Amazon page to load when the Playstation 5 goes on sale ?!!!). To understand the current nature of Javascript on this parameter we need to understand the behaviour of compiled languages.
Well, the programming languages that are 'compiled' such as Java, C++, C etc, generally have a compiler which converts the entire code from high-level language (comprehensible to humans) to the binary sequence of 0's and 1's also called assembly language(comprehensible to your computer). Compilation creates an executable bytecode, which can then be run by the Runtime Environment at any time in the future. A typical compilation workflow looks as follows:

Compiled languages are much faster than interpreted languages. This can be appreciated by the following chart( taken from a brilliant medium article which I would highly recommend you to read):

Javascript follows a two-phase process of Parsing and Compilation. The JS specification calls for "early errors", i.e. if there are errors then they should be caught the earliest possible, preferably before the code execution.
The parsing phase achieves this by just reading the code from beginning to end, to find any obvious errors like a duplicate declaration of variables. The result of an error-free code after the parsing phase is the creation of an Abstract Syntax Tree(AST). Thereafter the compiler converts the AST to an executable bytecode just before execution.
Once the execution begins, the Javascript Engine keeps on optimizing the execution in multiple cycles allowing you to load the Amazon page in milliseconds (with the bottleneck being your internet bandwidth and not javascript) and hopefully secure that elusive Playstation 5.
Thus Modern javascript, with its parsing and just-in-time compilation, is closer to compiled languages in spirit, if not in practice. The below image summarizes this lecture in a flowchart.

See you in the next write-up where we will read more about the Javascript Runtime Environment.