Understanding Mid-Water Discoveries: Compilation, Interpretation, and JIT-Compilation

I have some experience with languages such as C++, Java, Python, and JavaScript, as well as runtime environments like Python runtime, JRE, and V8. So, here we will shed some light on terms like compilation, interpretation, and Just-In-Time (JIT) compilation in simple, non-technical language (still requires a basic knowledge before the read).

We may have heard or known that there are two types of languages: languages that can be compiled and languages that can be interpreted. C++ is a classic example of a compiler-driven language, while Python is an interpreter-driven language.

In a language that can be compiled, the source code gets compiled into binary code or into intermediate code. For instance, C++ compiles down to a .obj file and .exe file (in case of Windows) that the computer can execute in the specific OS which follows a certain architecture to execute the binary. Java produces byte code (in .class file) when compiled. This intermediate code produced is usually OS independent, allowing it to be compiled further into a binary file and run on any OS. This is why we refer to Java JDK (and thus Java) as OS independent, as it is the tool used to create the intermediate .class file.

In the case of an interpreter-driven language, the code gets compiled to binary code during execution itself, on the fly. Python is a common example of this. This method allows the source code to be moved across different operating systems, with the interpreter handling all the OS-specific tasks and executing the code. Therefore, you won't find any intermediate or binary files generated for these types of languages.

Then there is another type of language set that falls under JIT-compilation languages. JIT (Just in Time) compilation is similar to regular compilation as it produces intermediate code during compilation that is optimized for execution. However, it differs in that it behaves more like interpretation. This means that compilation happens during execution. This differs from interpretation where each line of code is interpreted and executed. In JIT compilation, optimized intermediate code is produced, then interpreted and executed as a whole as and when needed. A popular example of these kinds of languages is JavaScript.

So far we have touched the mid-water in the ocean of languages, binaries and their computer science. We won't go to the deep water here since I am afraid of being uncomfortable there with my limited knowledge. But internet is vast you know.

Hope the effort put into writing this article has imparted some knowledge to you as a reader.

Signing off! See you around.