Code Compilation Vs Code Interpretation

Anurag SAnurag S
2 min read

What is code compilation?

Code compilation means converting "entire" code into machine readable format, i.e converting a code such that operating system can understand (example - 011001100010...). Hence code compilation means converting entire code set/code base, into machine executable format. Ex- C++, C

What is code interpretation?

Code interpretation means, converting a code into machine readable format (ex- 10011001100...), but the code is interpreted/translated, on a line by line basis, not entire set. Ex- JavaScript, PHP

Compiler code Vs Interpreted code

Compiled Code- slow when code is compiled for the first time and then fast to execute, going forward.

Compiled Code- Since the code is already compiled (converted into executable- 10011000110...), run time just need to execute it, i.e. faster execution

Compiled code`- since it is already a compiled code, it is optimized for CPU utilization, type safe, and compatible to operating system on/for which it is compiled for, i.e. cannot run the same executable on another Operating system

Compiled Code- any new edits made in the code is compiled mush faster, since it uses just in time (JIT) compiler, to compile only the modified/edited portion of code.


Interpreted code- since it's a line by line translation, interpretation is much faster (on a line by line basis). However, every time you make a change, interpretation has to be done again, line by line for entire code set, making is slow, eventually.

Interpreted code- every time a change is made, interpretation is done right from the beginning.

Interpreted code- since it is interpreted every time you run the code, it can be run on any operating system i.e. code interpretation are not tied to a specific OS, it's just that the machine/browser interpreting the code, need to have interpret to understand the code.

0
Subscribe to my newsletter

Read articles from Anurag S directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anurag S
Anurag S