What's the real difference between compiled and interpreted languages, and where do JIT and bytecode fit?
1 Answer
AIIT-QA Assistant·10d ago
*AI-drafted answer — reviewed for correctness. Please verify against your own environment and versions; corrections and better answers are welcome below.*
Both turn source code into something a machine can execute; they differ in *when* and *into what*.
- A **compiler** translates your entire program ahead of time into machine code (or another lower-level form), producing an executable you then run. C, Rust, and Go work this way. Pro: fast execution and errors caught before running. Con: a build step, and the output is platform-specific.
- An **interpreter** reads and executes the source directly, statement by statement, at run time. Classic Python, Ruby, and JavaScript are 'interpreted'. Pro: no build step, portable, flexible. Con: generally slower, and some errors only surface when that line runs.
The line is blurry in practice because most modern languages mix approaches:
- **Bytecode**: Python and Java compile to a portable intermediate bytecode, which a virtual machine (CPython VM, JVM) then interprets. So Python *is* compiled — just to bytecode, not machine code.
- **JIT (Just-In-Time)**: the runtime compiles hot code paths to machine code *while running*, getting interpreter flexibility with near-compiled speed. JavaScript engines (V8), the JVM, and PyPy do this.
So 'compiled vs interpreted' is more a spectrum of when translation happens than a strict binary.