What is a Jitter?

Asked

Viewed 1,952 times

34

In the context of software development what is a Jitter?

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

As it differs from a compiler?

  • (partially) related: How to run an application . Net?

  • @jbueno I made the game precisely because I mention Jitter in many places and it doesn’t have a good reference for those who want to know more. I’m going to edit these responses and see if I need to complement something here to give a context that fits all cases.

  • Is it Jiter or Jitter? I mean, it’s 1 or 2 t’s?

  • @Victorstafusa Wikipedia’s the way I did, I don’t know if it’s right: https://en.wikipedia.org/wiki/Jitter_(disambiguation)

  • @I thought this was JIT, and Jitter was a measure of network communication.

  • @Murillogoulart JIT is the action, Jitter is the executor of the action.

Show 1 more comment

2 answers

29


Jitter is short for Just-In-Time Compiler or compiler on demand. 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 while running the application. It is common to be necessary when the application has been generated in some intermediate form and runs on some virtual machine that will generate a binary code to be executed by the processor. It’s as if he creates the effectively executable code in memory when he needs it. But he can also do it directly in language source code.

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

It also differs from an interpreter because it generates binary executable code and the interpreter uses some form of selection than to execute. You can’t compare efficiency, so much difference. It is also common for the interpreter to interpret again in each execution cycle while Jitter can run only once in that code no matter how many times it runs.

The main goal of this type of compiler is to give better performance, comparing to interpretation. In environments where JIT compilation is done on top of source code the gain is obvious.

In case where there is already a previous compilation there can also be 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 linked dynamically. But actually the goal in these cases is to facilitate use on several different platforms with the same distribution.

Functioning

There are some working strategies. Some run right at the beginning of the application load, others compile as the functions are called, others try to balance these two forms. Some are rewarding with better optimizations as the application runs and collects usage statistics (called hotspot). It’s even possible to start from a previously generated native code and Jitter will be running new binary code to replace parts where he discovered in execution that can be more efficient.

It’s rare that they’re so smart and ideal. It is said 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 build on demand and stores the binary executable before execution. It can still be considered a Jitter because it is executed in the place where the application will be executed. This can help the application load be faster since Jitter usually delays its start until it has something ready for execution.

It 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 smarter ones can improve optimizations as they realize that the gain exceeds the cost of better analysis. It can benefit from information only obtained at runtime to make the best decision, but the AOT already has techniques that allow optimization by statistics. Some have layers and the more he realizes that something is used frequently the more Jitter does optimizations.

The presence of a pre-compiler reduces the cost of compiling JIT as it can take care of several aspects where it is best to define beforehand. Normally this compiler functions as a frontend, while Jitter works as a backend. It can be a complete compiler and keep both parts, typical case of Jitters running on the basis of source code.

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

Example of how to make a simple Jitter.

Use

Many dynamic languages 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 the main databases. They all generate native or intermediate code from source.

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

Jitters have been able to give very good performances because they compile at runtime. It was said that a sufficiently good Jitter could make the codes be more optimized than one generated in an AOT way, and in fact today it happens in some points. It still has something to improve, but it is already a partial reality.

  • So C# also uses the bytecode pre-compiler is that right ? I understand that C# has two compilations, that the first one is for MSIL and then is generated the machine code that in the case is the JIT that generates, is that right ? or I’m confusing things ?

  • 1

    The bytecode is the CIL or MSIL as you called it. Technically the CIL is the textual version of the intermediate code and the bytecode is the binary version. Since they have a one-to-one relationship, it’s almost the same thing. When someone says that CIL turns into native code, they’re actually talking about bytecode. You’re not wrong, you just don’t have to.

  • I ended up getting a ride in this post and it’s clearer now. https://answall.com/questions/118694/como-function-a-execu%C3%A7%C3%A3o-de-uma-aplica%C3%A7%C3%A3o-net

0

Just clarifying:

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

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

  • Both are with two T’s. "Vowel Sandwich" in English causes the last consonant to double.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.