Published on

Compiled Code vs Interpreted Code

Author
  • Name
    Robert Kirby
    Title
    Lead Full Stack Developer at Y-Squared

Blog Post 7

Compiled Code vs interpreted Code

1 Compiled vs Interpreted

2 Pros and Cons

3 Language Examples

4 What is JIT

5 Conclusion

6 Contact, Socials & GitHub

1 Compiled vs Interpreted

A compiled language is a programming language that is converted into machine code that can be executed directly by the computer's central processing unit (CPU). This machine code is typically produced by a compiler, which translates the source code written by a programmer into machine code that can be run on a computer.

An interpreted language, on the other hand, is a programming language that is not directly executed by the computer's CPU. Instead, it is executed by an interpreter, which reads the source code and executes it on the fly.

One of the key differences between compiled and interpreted languages is the way in which they are executed. Compiled languages are translated into machine code before they are run, while interpreted languages are executed directly from the source code. This means that compiled languages typically run faster than interpreted languages, but interpreted languages are often easier to write and modify.

2 Pros and Cons

Here are some pros and cons for each type of language:

Compiled languages:

Pros:

  • Typically run faster than interpreted languages
  • Can be run on any type of computer
  • The compiled code is typically more secure than the source code

Cons:

  • Requires a separate compilation step before the code can be run
  • The compiled code is typically specific to a particular type of operating system or hardware its running on, so it may not be portable to other types of systems

Interpreted languages:

Pros:

  • No need for a separate compilation step
  • Often easier to write and modify than compiled languages
  • Can be run on any type of OS or hardware that has an interpreter

Cons:

  • Typically run slower than compiled languages
  • The source code is typically visible to anyone who has access to the program, so it may not be as secure as compiled code

3 Language Examples

Some examples of compiled languages are C, C++, and Rust. These languages are typically compiled into machine code that can be executed directly by the computer's CPU.

Some examples of interpreted languages are Python, JavaScript, and Ruby. These languages are not compiled into machine code, but are instead executed by an interpreter that reads the source code and executes it on the fly.

It's worth noting that some programming languages, such as Java and C#, can be either compiled or interpreted, depending on how they are implemented. In these cases, the source code is typically compiled into an intermediate form called bytecode, which is then executed by an interpreter or virtual machine.

4 What is JIT

JIT compilation, or Just-In-Time compilation, is a technique used by some programming languages to improve the performance of their programs. In a JIT-compiled language, the source code is compiled into machine code during the execution of the program, rather than being pre-compiled before the program is run.

One of the main advantages of JIT compilation is that it can improve the performance of programs by compiling the code into machine code on the fly, rather than having to interpret it each time it is executed. This means that JIT-compiled programs can run faster than programs written in interpreted languages, without the need for a separate compilation step.
However, there are also some disadvantages to JIT compilation. For example, because the code is compiled on the fly, it may take longer to start up than a program written in a compiled language. Additionally, JIT-compiled programs may use more memory than programs written in compiled languages, because the compiled code must be stored in memory in order to be executed.

JIT compilation is typically used in situations where it is desirable to improve the performance of a program without sacrificing the ease of development and flexibility of an interpreted language. For example, JIT compilation can be useful in applications that require real-time performance, such as games or real-time data processing systems.

JIT compilation is used in a variety of programming languages, including Java, C#, and Python. In these languages, the source code is typically compiled into an intermediate form called bytecode, which is then executed by an interpreter or virtual machine that uses JIT compilation to improve the performance of the program.

It's worth noting that JIT compilation is not always the best option for improving the performance of a program. In some cases, using a compiled language may provide better performance, while in other cases the overhead of JIT compilation may outweigh the benefits. It's important to carefully evaluate the specific requirements and performance goals of a program in order to determine whether JIT compilation is the right choice.

5 Conclusion

In this post, we discussed the difference between compiled and interpreted languages, as well as the concept of JIT compilation.

Compiled languages are programming languages that are converted into machine code that can be executed directly by the computer's CPU, while interpreted languages are executed directly from the source code by an interpreter.

JIT compilation is a technique used by some programming languages to improve the performance of their programs by compiling the code on the fly during execution. JIT compilation can improve the performance of programs written in interpreted languages, but it is not suitable for all situations and may not always provide the best performance.

6 Contact, Socials & GitHub

Please contact us if you see any mistakes on this post, have any suggestions or business inquiries.

Please fill out the form on https://y-squared.com/contact or email us at team@y-squared.com.

The Author:This post was written by Robert from Y-Squared:

Click here to follow me on Github @Rob1818

Connect with me on LinkedIn

Blog Site:

https://y-squared.blog/

Medium:(Follow me on medium)

https://medium.com/@Robert-Y-Squared

This article is also available on Medium:

https://medium.com/@Robert-Y-Squared/compiled-code-vs-interpreted-code-8d93056a19e4

Business Site:(Fill in the form if you have any business inquires)

https://y-squared.com/