Saturday, April 7, 2012

Compiled Languages vs Interpreted languages

A compiled language is one where you have to compile the source code before it can be executed. The compilation process transforms the source code into machine executable code, which is stored in a separate file. The machine executable code is invoked to actually run the application. Thus in compiled language the source code needs to be compiled before it can be executed. Eg. C, C++

An interpreted language is one where you can execute the source code directly without compilation, by the help of an interpreter. The interpreter reads the source code and executes. Eg. Php, Perl, Python

Compiled programs generally run faster than interpreted ones because interpreted ones must be reduced to machine instructions at runtime. However, it is easier to develop applications in an interpreted environment as you don't have to recompile the source code each time to test it.

Where does Java come?
Java is both compiled and interpreted language. The source code is first compile and converted to byte code - which is stored in .class files. The byte code is then interpreted by the JVM during execution time.

What are JIT compilers?
JIT stands for Just-In-Time compiler. They are used in interpreters (specially in Java VM) to improve the runtime performance. They convert the byte code into native instructions before executing them, so that they can take full advantage of underlying architecture.

No comments:

Post a Comment