When it involves code compilation and execution, no all programming languages monitor the same approach. One of the usual although not ideal means to differentiate them is to break-up them into 2 groups compiled and interpreted languages.

The key goal that both compilation and also interpretation is to change the human-readable source code into machine code that deserve to be executed directly by a CPU, however there space some caveats to it.

You are watching: Is ruby a compiled or interpreted language

One that the key things we need to understand is the a programming language itself is neither compiled no one interpreted, however the implementation of a programming language is. In fact, over there are plenty of programming languages that have been applied using both compilers and interpreters.


Java can be a great example of together a language as Java’s source code is compiled come an intermediary representation called bytecode and interpreted through Java’s interpreter the is a part of Java Virtual device (JVM). This is a standard process present in every one of Java’s renowned implementations.

Compiled language

A compiled language is a programming language the is commonly implemented using compilers fairly than interpreters. A compiler is a regime that equates statements written in a details programming language into another language usually an equipment code. A conventional compiler rather of translating code on the fly does all of its work-related ahead of execution time.

A good example the a compiled language is C++.

In C++ the source code is compiled into maker code. The compilation procedure consists that preprocessing, compiling and also linking, but the end result is one of two people a library or one executable that have the right to be executed directly by a CPU that the regime was compiled for.

The main advantage of compiled languages is the speed of execution as the executable the contains machine code deserve to be straight executed ~ above the target device without any added steps.

The key drawbacks are negative portability as programs need to be compiled because that a particular CPU architecture and also a long time that is forced for the actual compilation.

Other instances of famous compiled languages space C, Go, Haskell or Rust.

Interpreted Languages

An interpreted language is a programming language that is commonly implemented using interpreters and doesn’t compile source code directly into maker code front of execution. The interpreter executes program translating every statement right into a sequence of one or an ext subroutines and also then into device code. We deserve to say that the interpreter equates programs on the fly instead of focusing on the entirety program in ~ once.

Even though interpreter might be translating resource code into device code, this days many of the interpreters job-related with an intermediary representation likewise called bytecode in most understood programming languages. This is since interpreting resource code directly would be fairly slow and also most interpreted languages benefit from compiling into bytecode very first that deserve to prepare and optimise the code for further interpretation into machine code.

There space not many totally interpreted language left. One noticeable example is Javascript that relying on the implementation have the right to be totally interpreted. This way that the source code of the actual program would be understood by the interpreter and also translated into maker code on the fly. This feature was quite helpful in Javascript as the code could be conveniently sent end the network and also executed in the user’s browser.

Even though it is quite difficult to find any popular language in the totally interpreted language category, we have the right to easily uncover plenty of them in the bytecode taken one. The examples are Java, C#, Python or Ruby.

The key benefits of making use of an construed language room portability together programs don’t have to be compiled for a particular CPU architecture and faster compilation process (for the language implementations the compile to bytecode).

The main drawbacks space usually slower execution speed and also potential because that leaking resource code if the non-obfuscated source code is sent to the client.

Middle ground? JIT Compilation

So far it looks like both of the languages compiled and also interpreted have their pros and also cons.

What if ns tell friend you can still attain the rate of a completely compiled language there is no sacrificing portability and faster compilation time? sounds impossible? This is where JIT compilation comes to play.

JIT or just-in-time compilation is a hybrid in between normal compilation also called ahead-of-time compilation and also interpretation. Instead of translating each statement native the input paper (which is commonly bytecode), JIT has the capability to store currently compiled device code so it doesn’t have to translate it each time.

JIT compilation works by analysing the password that is being executed (usually bytecode) and making decision which components of the code need to be fully compiled to device code based on how regularly that piece of password is gift executed (and a few other factors).

The main benefit of this strategy is high execution speed as every the critical and often executed code pieces are totally compiled into device code. This comes at a expense of a bit slower execution during the initial period when the critical code fragments are being analysed and are not totally compiled yet.

A complete explanation of the JIT compilation process is exterior of the limit of this video, yet I’m thinking about creating an additional one committed to the JIT compilation as this is a supervisor interesting process that not everyone completely understands.

Some that the language that exploit JIT compilation space Java, C#, Pypy (alternative Python implementation) and V8 (Javascript engine).


Let’s to compare a couple of main attributes of compiled, interpreted and also JIT-compiled languages one by one.

execution speedfastslowusually quick (depending top top the JIT implementation)
compilation timeslowfast (bytecode)fast (bytecode)

As you probably currently noticed dividing programming languages right into compiled and also interpreted language is quite artificial as there is no a lot of totally interpreted language left.


Most the the renowned programming languages this days fit right into one of these 3 categories compiled, compiled to bytecode and interpreted and also compiled to bytecode and interpreted v JIT compilation.

See more: Who Is The Shortest Nba Player To Dunk (#3 Is A Hall Of Famer)


One more interesting fact before we plunder this up.

When it concerns programming languages through a multitude of different implementations, Python is just one of the winners.


This is a non-exhaustive perform of Python’s different implementations

IronPython (Python to run on .NET)Jython (Python to run on the Java digital Machine)PyPy (Python with a JIT compiler)

If friend have any questions about compiled and interpreted languages or any kind of suggestions because that the following videos you re welcome comment down below.