Just In Time (JIT) Compilers - Computerphile

preview_player
Показать описание
A look at why (under certain circumstances) JIT Compilers can be so much faster. Dr Laurence Tratt of KCL takes us through the details.


This video was filmed and edited by Sean Riley.


Рекомендации по теме
Комментарии
Автор

There was a feature in the very first version of FORTRAN, intended to mollify the Assembler users of the 1950s about “efficiency, ” which allowed the programmer to “assist” the compiler in compiling efficient code for nested loops. Basically, it consisted of a FREQUENCY and an EQUIVALENCE statement. The programmer would specify an estimated number of inner loop executions per outer loop execution with FREQUENCY, and the pattern of memory reusability with EQUIVALENCE. Combined with other information collected during the compilation, FORTRAN could optimize when subscripts could be kept as the equivalent values in an index register, when they could be kept as index values but stored during a loop, or when they actually had to be kept in memory as subscripts (eg when the subscript value had to be printed out). These statements allowed the compiler to generate code closer in efficiency to what an Assembler programmer could produce, while wasting less time in the compiler doing the optimizing.

These statements were always optional, and were often added after test runs to produce a production version of a program. Later compilers which required less optimization (because computers were faster and had more storage) retained the ability to accept these statements (for compatibility), but ignored them.

These features helped overcome the bias of Assembler programmers against high level languages (known as “automatic” programming at the time), so that FORTRAN and other high level languages became successful.

allanrichardson
Автор

Do Just In Time Compilers come with Almost Too Late Debuggers?

obiwanjacobi
Автор

That's maybe the best explanation why Python, Java and other canonically interpreted langs can differ in performance so much depending on the

juliuszkocinski
Автор

It would be great if you could talk about the "scary how clever they've gotten", it's exciting to hear a statement like that so would love to know more

animatrix
Автор

The compiler is removing the loop because the “a” variable is not being used after the loop! If you print the “a” variable at the end the “time” will be different.

gmpassos
Автор

The comparison between Just In Time compilation and out of order pipelines is brilliant. Never though about it before.

XLucas
Автор

The downside of JIT is the final behavior is not locked down and determinant in a way that can be practically tested with certainty, so runtime behavior can't be effectively verified for critical applications.
eg Some fool at Boeing tried to use Java for a critical embedded control, worked fine most of the time but about 1% of the tests would have failed activation because the JVM was busy doing stuff when the signal came in.
If a game drops a frame here or there or misdraws a few pixels, it's a minor annoyance if it is even noticed, If a jet doesn't retract its landing gear or an automated defibrillator(medical) glitches, it will be noticed and more than an annoyance.

mytech
Автор

A major use for JIT compilation: emulators. Huge performance boosts were gained by using JIT instead of straightforward interpretation for translating the machine code of the emulated system into the host's machine code. Especially important for emulating more recent systems. Of course, what constitutes "recent" depends on when the post was written. When I first heard of it being used, it was the Playstation 2 and Gamecube that it was being applied to (possibly the Wii as well), and there wasn't any way of emulating the PS3, or Xbox360 yet. With the last couple of crops of consoles using x86 processors, emulating one might have more in common with running Windows in a virtual machine instead.

Roxor
Автор

I looove computerphile. i work in construction but everytime i watch one of your videos I realize what i really wanna do in my life... thx you guys so much!

Christian-pxzt
Автор

We need a video of Dr. Tratt explaining how scary the processors have got as soon as possible!

wlockuz
Автор

Tratt, I've been a fan of your writing (and some of your research) for years!

The work you did on the (missing) warm up of JITs with the PyPy guys is downright amazing :)

(The stuff I'm not a fan of? Mostly the style of language you chose for your Converge language -- I agree with pretty much all your goals for it, of course. De gustibus non est disputandum...)

peterfireflylund
Автор

I'm fairly sure it's impossible to have a fully-static implementation of a javascript compiler that also completely implements the ECMAScript spec. This is true for most "JIT/interpreted languages"

For example: Runtime reflection on aribtrary data types is often a key feature in JIT/interpreted languages and this is in general incompatible with static compilation.

Another example is runtime evaluation of generated source code. A compiler could embed itself into the compiled program and invoke itself for these cases but then it's no longer statically compiled and you effectively just have a JIT compiler.

aaronau
Автор

Hey Brady, please ask Dr. Tratt to change his computer password; the video shows him typing it in at 3:18. While the risk is low (camera angle is pretty flat), a dedicated attacker might be able to figure out his password from his finger movements and use it. Better safe than sorry.

Excellent video btw!

snickersm
Автор

A decent optimizing compiler will detect that that loop has no side effects (including output) and that the result of summation isn't used anywhere, and will simply throw the whole thing out. To prevent that outputting the final sum would suffice.

bazoo
Автор

as someone who works on the v8 js engine in chromium I quite enjoyed this video. people often think jits are a lot scarier than they really are and education in this area is always appreciated! also shout-out for using a framework laptop :)

devsnek
Автор

This video just explained something I've known about (and leveraged) for _many_ years now, but never truly understood, in a simple bite-sized way. Thank you!

soranuareane
Автор

Great and full of insights as always! Just gave a lecture about JIT yesterday, posted this video to students.

sergeyrykovanov
Автор

Static compilers can have just as much info as JIT when given runtime info. This is often done using a technique called PGO and usually leads to the absolute fastest type of programs when combined with other static compilation optimizations (LTO, binary optimization [bolt], etc...)

FinaISpartan
Автор

finally someone uses one of the two editors and it's even the one, that can be used without surgical alteration of the editing hands...I think that's a first for computerphile.

Автор

Was confused about this for a long time. This video cleared most of my doubts.

JaishreeramCoder