/ COMPUTER-FUNDAMENTAL

difference between compile and interpret

Compiler is translating “the entire codes” in advanced language to machine language at one time.
Interpreter is translating the sourcodes “line by line” to machine language. processimg

  • Compiler is slower than Interpreter at the first translation
  • Once compile done, Compiler is faster than Interpreter to execute the file.

Most of time, Compiler is faster than Interpreter. However some languages use Interpreter for some reason.
The reason is that Interpreter is compatible to other hardware, but Compiler is not.


For example, cpu A is not compatible with cpu B.

processimg Compiler is translating advanced language to machine language directly. It does not change the compatibility.
Developers should make the software in B environment as well.

processimg Interpreter is translating advanced language to bytecode, and the virtual machine translates the bytecodes to machine language being suitable for B hardware environment.


Python is interpreter language, C languages are compile language, this is why c is a programming language for hardware control system (hardware must be fast).

However, Java is compile and interpreter language. In java, java compiler translates .java file into .class file by bytecode, and java virtual machine is translating bytecode to object codes.