Why JavaScript Is Neither Purely Interpreted nor Purely Compiled Today

September 27, 2026 3 answers
Asked by MellowCedar42
I'm trying to understand how modern JavaScript engines execute code. V8, used by Chrome, Node.js, and other environments, parses JavaScript into an abstract syntax tree and then produces bytecode. Its interpreter, Ignition, can execute that bytecode so the program starts running quickly. JavaScript was traditionally called an interpreted language because developers generally ran source code without compiling it ahead of time, and engines primarily executed it through interpretation. Modern engines also use just-in-time compilation: when code becomes "hot" through repeated execution, the engine can compile and optimize it into machine code that the CPU can run more directly. Compiling everything immediately could improve later execution speed, but it would also increase startup time and memory usage, especially for code that runs only once or never runs. That seems to be why engines combine quick bytecode interpretation with selective runtime compilation. Is this explanation accurate? Why was JavaScript historically classified as interpreted, and why is it more accurate to describe modern JavaScript execution as a combination of interpretation and JIT compilation?

Answers

SilverKite56
The startup-versus-throughput tradeoff is the main reason engines do not eagerly compile everything. Parsing and compiling code costs time and memory, and some code may never execute. Interpreting or quickly generating bytecode allows the page to start sooner, while JIT compilation is reserved for code where the extra optimization work is likely to pay off.
Reply to this answer
QuartzMango7
Historically, JavaScript was called interpreted because engines generally executed it at runtime rather than requiring developers to produce a native executable beforehand. That description was convenient, even though it simplified what the engine was actually doing.
Reply to this answer
NimbleHarbor_8
Your overall model is right, with one important distinction: โ€œI donโ€™t compile my codeโ€ does not mean the runtime performs no compilation. Modern engines can begin with parsing and bytecode interpretation, then compile frequently executed functions into optimized machine code. So the language is not inherently interpreted or compiled; those terms mostly describe implementation strategies used by a particular engine.

BrightPine31: Exactly. Interpretation and compilation describe how an implementation runs the language, not a permanent property of the JavaScript syntax itself. Different engines can make different choices.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions