Ygor Serpa
1 min readAug 12, 2020

--

The problem is that JIT is many times better than AOT, see C# as an example. It boils down to the following:

1) if you run something once, AOT will beat JIT, as it skips the compilation process that has to be done on the spot.

2) if you run something several times, JIT catches up, as it only has to compile code once. This especially true for long running applications, like servers or machine learning.

3) AOT compiled code has no idea of the machine it will run upon, so it optimizes to "the average machine". JIT, on the other hand, can inspect the current machine and create a custom-tuned compiled version of the code for that specific machine. Now re-read (1) and (2). You will notice that, for (2), the JIT will easily pass the AOT performance (as it only has to go all this trouble once)

You may think that this is bullshit, but it ain't. Different generations of Intel processors have different throughput and latency values for each instruction and some have newer instruction sets, such as AVX, AVX2, AVX-FMA and AVX-512. If these special instructions are used, massive gains can be achieved (up to 32x the performance).

On the C/C++ side, people often have to code several variants of the same functions that are dynamically routed to better exploit the hardware. JIT languages can do that on the go with minimal developer effort.

As an end note, almost all new languages are JIT based, that ain't no coincidence. It is just better on the long run.

--

--

Ygor Serpa
Ygor Serpa

Written by Ygor Serpa

Former game developer turned data scientist after falling in love with AI and all its branches.

No responses yet