World's most popular travel blog for travel bloggers.

How is a JIT compiler different from an ordinary compiler?

, , No Comments
Problem Detail: 

There's been a lot of hype about JIT compilers for languages like Java, Ruby, and Python. How are JIT compilers different from C/C++ compilers, and why are the compilers written for Java, Ruby or Python called JIT compilers, while C/C++ compilers are just called compilers?

Asked By : Ken Li

Answered By : Victor Stafusa

JIT compilers compiles the code on the fly, right before their execution or even when they are already executing. This way, the VM where the code is running can check for patterns in the code execution to allow optimizations that would be possible only with run-time information. Further, if the VM decide that the compiled version is not good enough for whatever reason (e.g, too many cache misses, or code frequently throwing a particular exception), it may decide to recompile it in a different way, leading to a much smarter compilation.

On the other side, C and C++ compilers are traditionally not JIT. They compile in a single-shot only once on developer's machine and then an executable is produced.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/257

0 comments:

Post a Comment

Let us know your responses and feedback