Britannica Sources used in this answer

Why can compiled programs run more efficiently than interpreted programs?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

The premise that compiled programs are inherently more efficient than interpreted ones is a standard distinction in computer science, though modern execution environments often blur these lines.

A compiler translates an entire program into machine code before execution. Because this translation happens once, the resulting code is saved and can be executed directly by the computer's hardware whenever needed. This eliminates the overhead of translating instructions during the program's runtime.1

In contrast, an interpreter examines and executes a program one instruction at a time. This process requires the interpreter to call on additional code to perform the necessary machine operations for every single instruction during execution, which typically consumes more time and resources than running pre-translated machine code.1

To balance these approaches, some languages use an intermediate step, compiling code into a virtual machine language that is more efficient to interpret than high-level source code, while maintaining platform independence.1