7 ms·
Just in time compilation, I think it should be called “continuous profile guided compilation” instead, describes better the awesomeness that happens...
by walkingolof 7y ago
Just in time compilation, I think it should be called “continuous profile guided compilation” instead, describes better the awesomeness that happens...
- chrisseaton 7y agoSome people differentiate between just-in-time compilation, which is what for example .NET does (or did, last time I checked), where it just literally compiles it as it would ahead-of-time, but at the last second before executing it for the first time, and dynamic compilation, which is for example what Graal does - compiling based on runtime conditions, possibly multiple times with different results as the program executes.
- lewurm 7y ago> [...] which is what for example .NET does. .NET is the platform. There are different implementations for it doing different things. JIT compilation is still different to AOT even without profile guided optimizations. Simple example: In AOT code you can't embed pointers easily and is often solved with indirection (e.g. something like GOT in ELF).
- chrisseaton 7y ago> There are different implementations for it doing different things. And are they now speculative? They weren't for the first 15 years or so.
- lewurm 7y agoCoreCLR started to implemented Tiered Compilation https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/tiered-compilation.md https://github.com/dotnet/coreclr/blob/master/Documentation/... It's experimental currently, no profile guided optimizations _yet_
- pjmlp 7y ago.NET Framework supports PGO since .NET 4.5.
- pron 7y agoJITs do more than just profile-guided optimizations. Their secret weapon is speculative optimizations that mean they don't need to work hard (and often fail) to prove the soundness of certain optimizations. They're allowed to guess and be wrong.
- the8472 7y agoAnother advantage they have is that they can focus the spent optimization cycles on hot code. AOT compilers can't afford running optimization passes in a loop (inline, optimize, inline, optimize, ...) until they reach a fixed point because that would blow up compile times if that were applied to the whole program.
- astrange 7y agoThis almost never matters. You just start at the leaves and go up and then you're done. Most people aren't interested in complicated superoptimizations, because a predictable compiler is more important.
- pron 7y agoThat's not true. A lot of very simple and useful optimizations are very hard to prove correct (e.g. devirtualization) and so can't be done with AOT compilers. It doesn't matter to people using languages that require the programmer to carefully control the compiler -- like C/C++ or Rust -- but it matters a great deal to languages that offer a smaller number of more general abstractions. It is virtually impossible to compile, say, JavaScript efficiently with an AOT compiler, but when compiled with a JIT it can have excellent performance.
- amelius 7y agoIf they do speculative optimizations, then doesn't that open the door to Spectre-like vulnerabilities, but now at the compiler level?
- chrisseaton 7y ago