Compiled vs Interpreted
Compiled
Interpreted
-
First we'll look at compiled versus interpreted languages.
-
For compiled languages, source code is processed by a compiler into executable CPU instructions.
-
When you run the application, the only work done is running the compiled logic.
-
For interpreted languages, such as a shell script, you are shipping the source code.
-
When you run the application, the source code is parsed and mapped to values during execution,
-
and then the relevant logic is run.
-
This interleaving of parsing and logic means the overall execution is slower.
-
An analogy is a cake recipe in a foreign language.
-
If I had a recipe given to me in Japanese, and I fully translated it up front,
-
then whenever I bake that cake, I can just use the recipe instructions.
-
If I did not translate it, and had to translate it every time I bake the cake,
-
then the process would be slow each time.