What is a JITter?

28

In the context of software development what is a JITter?

More and more people are talking about it and several languages are using the much-talked about JIT compilation.

How does it differ from a compiler?

    
asked by anonymous 09.08.2016 / 14:32

2 answers

25

JITter is short for Just-In-Time Compiler or compiler on demand. We can consider it as a dynamic compiler because it runs at runtime and can adapt the code as needed.

Unlike the traditional compiler, usually called the Ahead Of Time (AOT), it only works during the execution of the application. It is common to be necessary when the application was generated in some intermediate way and runs on some virtual machine that will generate a binary code to be executed by processor . It's as if he creates the code that is actually executable in memory when he needs it. But it can also do directly in source code of a language.

It is a very old mechanism, existing since we have languages of the highest level. Only recently has it become popular.

It also differs from an interpreter because it generates an executable binary code, and the interpreter uses some form of selection to execute. You can not compare efficiency, such is the difference. It is also common for the interpreter to have to interpret again in each run cycle while JITTer can run only once in that code no matter how many times it will run.

The main purpose of this type of compiler is to give better performance compared to interpretation. In environments where the JIT compilation is done above the source code the gain is obvious.

In case where there is already a previous compilation there can also be a gain to be able to better adapt to the actual execution environment, to be able to do global optimizations even in code that are dynamically linked. But in fact the purpose in such cases is to facilitate the use on several different platforms with the same distribution.

Operation

There are some operating strategies. Some run at the start of the application load, others compile as functions are called, others try to balance these two forms. Some will recompile with better optimizations as the application executes and collects usage statistics (called the hotspot ). It is even possible to start from a previously generated native code and the JITter will regenerate new binary code to replace parts where it discovered in execution that can be more efficient.

It's rare for them to be so smart and ideal that way. They say that a JITter can in theory produce better codes than those produced by traditional AOT compilers, but in practice we do not see this occurring.

In some cases there may be a pre-JIT that anticipates compilation on demand and saves the binary executable before execution. It can still be considered a JITter because it is run on the spot that will run the application. This can help make the application load faster because JITter often delays its start until something is ready for execution.

It's very common for a JITter not to do many optimizations since it takes a lot of time. It has to respond quickly, have low latency. Smarter can improve optimizations as you realize that the gain outweighs the cost of better analysis. It can benefit from runtime-only information to make the best decision.

The presence of a precompiler reduces the cost of JIT compilation since it can take care of several aspects where it is best to set in advance. Normally this precompiler works as a frontend , whereas JITter works as a backend . It can be a complete compiler and keep both parts, typical case of JITters that run based on a source code.

There are cases where the target code is not a binary.

Example of making a simple JITter .

Use

Many dynamic languages have implementations that do this. It is the case of most virtual machines who run JavaScript. Moon has a legendary JITTer . PHP should have soon.

SQL usually runs this way in the main databases. All of them generate the native code from the source code.

The most famous static languages that use JIT compilation are C # and Java that generate native code from an intermediate code generated by a precompiler called bytecode . Theoretically any language can have a JITter.

    
09.08.2016 / 14:32
0

Just clarifying:

JIT or JITer (with a "T") refers to this compilation Just In Time. (PROGRAMMING)

Jitter (with 2 "T" s) is the measure of variation of delay between successive data packets or variation in packet arrival time, caused by network congestion. Represents the variation in latency. (NETWORKS)

    
07.06.2018 / 16:34