6 ms·
If I understand it correctly JIT compiles down Hotspots to native code, so if the entire executable is already native it must be just as fast or faster.
by gabcoh 8y ago
If I understand it correctly JIT compiles down Hotspots to native code, so if the entire executable is already native it must be just as fast or faster.
- guipsp 8y agoThere are some optimizations hotspot can do that substrate cannot
- jhomedall 8y agoJIT compilation makes decisions on how to optimize the generated code based on run-time analysis the program. AOT compilation doesn't have access to that information, which can lead to slower code. However, because AOT compilation isn't delaying the execution of the program, it is allowed to take much more time to optimize the output.
- pjmlp 8y agoYou can AOT compile with PGO (Profile Guided Optimization) though.
- Bjartr 8y agoAnd if you can record profiling data from every machine the code will run on you might be able to be confident no JIT could do better, until a new processor (that is a compatible architecture to the executable) that wasn't available at the time of compilation comes around and JIT can still tune for things like cache sizes or processor features and the AOT executable is stuck not being able to take advantage of them.
- pjmlp 8y agoAgreed, but there are ways around it. For example, Android P will upload PGO data into the store, which is then distributed across all devices, and fed into the on-device AOT compiler.