Compilers, Interpreters, and JITs: How Your Code Actually Runs
Understanding how code execution works, from compilation to interpretation and JIT compilation.

When you write code, you might wonder how it actually runs on your computer. The process involves compilers, interpreters, and just-in-time (JIT) compilers, each playing a crucial role in translating your code into machine code that your CPU can execute.
What happened
The execution of code can be achieved through two primary methods: compilation and interpretation. Compilation involves translating source code into machine code beforehand, while interpretation involves translating and executing code line by line. Just-in-time (JIT) compilation combines these approaches, compiling code into machine code during execution.
The earliest published JIT compiler was attributed to John McCarthy's work on LISP in 1960. Since then, various programming languages and systems have adopted JIT compilation, including Smalltalk and Java.
Why it matters
Understanding how code execution works is essential for developers, as it affects the performance, security, and maintainability of their applications. JIT compilation, in particular, offers a balance between the speed of compiled code and the flexibility of interpretation.
Pros and Cons
- JIT compilation can improve performance by optimizing code at runtime.
- It allows for dynamic optimization and adaptation to changing execution conditions.
- JIT compilation can provide better security by enabling runtime checks and validations.
- JIT compilation can introduce overhead and slow down application startup.
- It requires complex implementation and debugging, which can be challenging.
- JIT compilation may not be suitable for all programming languages or applications.
How to think about it
When designing or implementing a language or system, consider the trade-offs between compilation, interpretation, and JIT compilation. Evaluate the performance, security, and maintainability requirements of your application and choose the approach that best fits your needs.
FAQ
What is the difference between a compiler and an interpreter?+
A compiler translates source code into machine code beforehand, while an interpreter translates and executes code line by line.
How does JIT compilation work?+
JIT compilation involves compiling code into machine code during execution, combining the benefits of compilation and interpretation.
What are the advantages of JIT compilation?+
JIT compilation can improve performance, provide dynamic optimization, and enhance security.
- engineering·3 min readClaude Code incurs 33k token overhead per request versus OpenCode’s 7k: cost and cache implications
Claude Code adds ~33,000 tokens before reading a prompt, while OpenCode adds ~7,000. We explain why this matters for cost, latency, and caching.
- engineering·3 min readWhy AI 2040 Scenarios Miss Real-World Constraints and What Builders Should Expect
A look at AI 2040 forecasts, their gaps with hardware realities, and practical guidance for engineers building tomorrow’s systems.
- engineering·3 min readFCC Approves Test of Space Mirror to Reflect Sunlight
The FCC has approved a test of a space mirror to reflect sunlight to Earth, sparking concerns about safety, astronomy, and environmental impacts.
The week’s highest-signal tech and AI stories, synthesized into a five-minute read. One email a week, no spam, unsubscribe anytime.