Re:A Deep Introduction to JIT Compilers: JITs are not very J...
by darksaints on Monday July 06, 2020 @12:47AM
(#23744786)
HotSpot certainly does better than the vast majority of JITs out there, but it is definitely not perfect. If you have a JIT cache that is too small (really easy to do if you're not aware of the JIT settings or what they do), or your code does most of its heavy lifting in functions that are not called very often (because call frequency is the only heuristic it uses to prioritize optimization), you can easily trap yourself into horribly optimized executables that the JIT doesn't know its way out of.
Re:A Deep Introduction to JIT Compilers: JITs are not very J...
by saagarjha on Monday July 06, 2020 @03:05AM
(#23745428)
> The most commonly used JIT in the world is almost certainly the one in the OpenJDK
I don’t know, there are a lot of people who browser the web using Chrome…
Re:A Deep Introduction to JIT Compilers: JITs are not very J...
by tsimionescu on Monday July 06, 2020 @03:19AM
(#23745498)
Oops, you're right, JS is certainly more commonly used, I forgot about that.
Re:A Deep Introduction to JIT Compilers: JITs are not very J...
by pjmlp on Monday July 06, 2020 @02:46AM
(#23745329)
And since Java 11, OpenJDK has inherited the PGO and JIT caches capabilities of J/Rockit, but people still use Java 8, so they have any idea of what modern Java JITs are actually capable of.
OpenJ9 and ART also have similar capabilities.
Basically, it will do something like: interpret a function for a the first few thousand times it is executed, collecting execution metrics. After a threshold is reached, next time that function is called, start compiling it, optimizing based on the execution metrics collected earlier. Leave behind a few hooks for future changes. Keep collecting metrics from function execution. If the profile of execution changes significantly, re-compile the function according to the new profile (possibly doing things like un-inlining).
This is perfectly aligned with a startup vs normal production use workflow. The only problems can appear if you have a continually changing pattern of execution through the same function.