What is a JITter?

In the context of software development what is a JITter?

More and more is being talked about and several languages are using the much talked about JIT compilation.

In what does it differ from a compiler?

Author: Maniero, 2016-08-09

2 answers

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

Unlike the traditional compiler, usually called AOT (Ahead of Time), it only works during application execution. It is commonly required when the application has been generated in some intermediate form and runs on some virtual machine that will generate a code binary to be executed by the processor . It's like it creates effectively executable code in memory when it needs to. But it can also do directly in source code of a language.

Is a very old engine, existing since we have higher level languages. Only more 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 of what to execute. Does not give to compare efficiency, such a difference. It is also common for the interpreter to have to re-interpret each run cycle whereas the JITTer can only run 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, comparing with interpretation. In environments where JIT compilation is done on top of source code the gain is obvious.

In case there is already a previous build can also there is a gain for being able to better adapt to the actual execution environment and be able to make global optimizations even in code that are dynamically linked . But in fact the goal in these cases is to facilitate the use on several different platforms with the same distribution.

Operation

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

It is rare that they are so intelligent and so ideal. They say that a JITter can, in theory, produce codes better 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 on-demand compilation and saves the binary executable before execution. It can still be considered a JITter because it runs in the place that there will be the execution of the application. This can help the application load faster as JITter often delays its start until you have something ready to run.

Is very common that a JITter does not do many optimizations since it takes a lot of time. It has to respond fast, have low latency. The smartest can improve optimizations as they realize that the gain outweighs the cost of better analysis. It can benefit from information only obtained at runtime to make the best decision, but AOT already has techniques that allow optimization by Statistics.

The presence of a pre-compiler reduces the cost of JIT compilation since it can take care of various aspects where it is better to define in advance. Typically this pre-compiler works as a frontend , whereas the 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 how to make a simple jitter .

Use

Many languages dynamics have implementations that do this. This is the case for most virtual machines that run JavaScript. Moon has a legendary jitter . PHP should have soon.

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

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

JITter has been able to give very good performances because they do Compile at runtime. It was said that a good enough JITter could make the codes be more optimized than one generated in AOT form, and in fact today it happens in some points. It still has to improve, but it is already a partial reality.

 29
Author: Maniero, 2020-11-05 13:17:19

Just clarifying:

JIT or JITer (with a "T") refers to this just in time build. (Programming)

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

 0
Author: Gustavo Trr, 2018-06-07 14:34:32