Compiled vs Interpreted

RohanRohan
2 min read

Let's compare two popular languages and see how they are executed. On one side we have C#, which is a popular compiled language, and on the other side we have python which is a popular interpreted language.

TL;DR

  • C# code is a compiled into IL code and then into machine code. This machine code is then executed.

  • Python code, like many interpreted languages, is compiled to bytecode. These bytecode instructions are then executed.

C# process

C# execution

Image source: Geeks for geeks

Python process

Python execution

Image source: Pro Code Guide

Compiled C# advantages

C# by default performs type checking at the compile time and as a result, type errors are pinpointed as early as possible.

Compiled code tends to run faster than interpreted code because it has been translated into machine code that can be directly executed by the computer’s processor.

Just-in-time (JIT) compilation from IL enables versatility of C# applications that can be run everywhere, from Windows to PlayStation.

Interpreted Python advantages

As an interpreted language, Python facilitates rapid development and testing, as code can be executed as soon as it is written without requiring a separate compilation step. This feature significantly speeds up the development process and makes Python an excellent choice for prototyping and iterative development.

Python’s interpreted nature makes it more flexible and dynamic, allowing for easier debugging and immediate feedback during the coding process. It also contributes to Python’s cross-platform compatibility, as the same Python code can run on multiple operating systems without modification, making it highly versatile for various applications.

As usual, I hope this was helpful!

References

  1. https://opensource.com/article/18/4/introduction-python-bytecode

  2. How C# Code Gets Compiled and Executed? - GeeksforGeeks

  3. https://procodeguide.com/python-tutorials/python-programming/

  4. https://www.geeksforgeeks.org/advantages-and-disadvantages-of-compiler/

  5. https://www.altexsoft.com/blog/c-sharp-pros-and-cons/

  6. https://www.redswitches.com/blog/advantages-and-disadvantages-of-python/

2
Subscribe to my newsletter

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

Written by

Rohan
Rohan

Software engineer and blogger