Q.Why is the execution time of the machine code less than that of source code?
Machine code runs directly on the CPU with zero translation overhead; source code must first pass through a compiler or interpreter, and that translation time is exactly why it takes longer.
The concept. A CPU is a circuit that can execute only one language: its own binary machine code. Whether a program starts life as machine code or as high-level source code, what ultimately executes is always machine code. The difference between the two is when and how often the translation happens — and translation costs time.
Executing machine code. The instructions are already in the CPU's native binary form. Execution is just the fetch–decode–execute cycle:
Machine code ---> CPU executes directly (no translation step)
Executing source code. The high-level program cannot touch the CPU until a translator converts it:
Source code ---> Translate (compile/interpret) ---> Machine code ---> CPU executes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
extra time spent here
Two cases make the overhead concrete:
- Compiled languages (C, C++): translation is a one-time prior step. Once compiled, the executable is machine code and runs at full speed — but the source itself is never executable; the compile time must always be paid before the first run.
- Interpreted languages (Python): the interpreter re-translates the program line by line on every run, interleaving translation with execution. Every execution of the program carries the translation cost, so an interpreted source program is noticeably slower than an equivalent machine-code program.
This is precisely why performance-critical software (operating systems, game engines) is distributed as compiled machine code, while Python trades some speed for ease of writing and testing.
The execution time of machine code is less because the CPU executes it directly, while source code needs an additional translation step (compilation, or line-by-line interpretation on every run) before the CPU can execute it — that extra step is the added time.
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.