Skip to main content
CSArchitecture & RuntimeDiagramBeginner

Compiler vs Interpreter

KO: 컴파일러 vs 인터프리터·EN: Compiler vs Interpreter·JA: コンパイラ vs インタプリタ

Comparing Ahead-of-Time Compilers (translating full programs into native machine code upfront) against Interpreters (executing code dynamically at runtime)

Table of Contents

Structure Diagram

Compiler (AOT) vs Interpreter Execution Model Comparison
COMPILERCompiler (AOT)

Translates full program to native machine code upfront

  • Runtime SpeedFastest (global optimization, native CPU)
  • Startup TimeBuild step upfront; instant binary startup
  • Error DetectionCatches syntax & type bugs before running
  • ExamplesC, C++, Rust, Go, Swift
INTERPRETERInterpreter

Executes source/bytecode dynamically on the fly

  • Runtime SpeedSlower (dispatch & dynamic type overhead)
  • Dev LoopZero compile wait; interactive REPL
  • PortabilityRuns anywhere the runtime exists
  • ExamplesPython (CPython), Ruby, Bash, PHP
Quick Answer

What is Compiler vs Interpreter?

Comparing Ahead-of-Time Compilers (translating full programs into native machine code upfront) against Interpreters (executing code dynamically at runtime). It is a core concept in Architecture & Runtime within CS.

Core Principles

Compilers and Interpreters represent the two fundamental execution pipelines for turning source code into CPU actions.

  • AOT Compiler: Parses source into an AST/IR (such as LLVM IR), runs global optimizations, and emits native machine code ahead of time.
  • Interpreter: Executes source or compact bytecode instruction-by-instruction inside a runtime VM loop.
  • Modern Hybrid Engines: JVM, V8, and .NET start quickly with bytecode interpretation and dynamically compile hot paths via JIT compilation.

Practical Takeaways

  • AOT shines for CLIs, containers, and serverless: Go and Rust produce tiny, zero-dependency binaries with millisecond cold starts.
  • Interpreters + native extensions: Python pairs fast iteration with compiled C/Rust/CUDA kernels (NumPy, PyTorch) for heavy math.
  • Deployment trade-offs: AOT requires target-specific builds (amd64/arm64); interpreters require matching runtime environments.

Notable Examples

  • AOT Compilers: GCC, Clang, rustc, Go compiler.
  • Bytecode Interpreters: CPython, Lua, Bash.
  • Hybrid JIT Runtimes: HotSpot JVM, V8, .NET CLR.