Science Fair Project Encyclopedia
- See also Just in time for the business technique
In computing, just-in-time compilation (JIT), also known as dynamic translation, is a technique for improving the performance of interpreted programs, by allowing for parts of a program to be partially compiled. This represents a kind of hybrid approach between compiled and interpreted languages.
In the past, some interpreters use an intermediate code, such as p-code or bytecode, where the source code is compiled half-way before run time, and later, at run time, it is interpreted from there. Such systems have been in use for many years, but generally the performance has not been enough to make it a serious competitor. In recent years the increased performance of computers has become such that such approaches like this now seem practical.
The basic idea behind a JIT is that the bytecode is smaller and easier to compile than the original source code, so that the time spent compiling it the "rest of the way" on any particular platform is quite small. In theory this means that the JIT system has the best of both worlds, it can run just as fast as other compiled code, yet the compiler for any particular platform is easier to write because the main bytecode compiler has already done most of the work.
Typical compilers examine the source code for a program and produce a machine-readable executable program. This style of compiler is widely used due to its performance advantages, but is limited in that the executable can only be run on the single platform it was compiled for. Although in theory a different compiler on another platform could be used on the same source code, in practice this is sometimes difficult or expensive to achieve due to differences in languages, compilers, or platforms. Thus a significant number of programs are limited to a single system.
The other approach, is for using an interpreter, which examines the source code on whatever platform it finds itself on. As long as an interpreter exists for a platform, the higher-level interpreted program will be able to run on it. On the downside, interpreters tend to be quite slow. While this is often acceptable for scripting languages, it is not for general purpose programming languages.
Dynamic translation was pioneered by the commercial Smalltalk implementation currently known as VisualWorks, in the early 1980s. Currently it is also used by most implementations of the Java virtual machine.
Sun's HotSpot Java virtual machine contains an example of a successful JIT implementation. In fact, it uses two: a "client" compiler which emphasizes fast compilation speed for applications that will be short-lived, and a "server" compiler which emphasizes highly optimized code for applications that will be long-lived. Users can choose which dynamic compiler is used depending upon the characteristics of their application.
Microsoft selected a JIT-based system for their .NET environment, and the Crusoe processor uses similar techniques in hardware. Parrot virtual machine also used JIT. Psyco is a JIT compiler for Python.
- L. Peter Deutsch and Allan M. Schiffman, "Efficient Implementation of the Smalltalk-80 System", 11th Annual Symposium on Principles of Programming Languages, Jan 1984, pp. 297-302
- Free Online Dictionary of Computing
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details