I had a neat conversation with @fniephaus on the GraalVM slack, where I was curious about how the performance of the Native Image mode could be almost an order of magnitude better in the Game of Life demo than JVM JIT mode.<p>He clarified that the GIF showed only the first N seconds of the program running, where the AOT binary required no warmup. But what was really interesting, is his comment about how AOT mode is still able to perform potentially slightly better than JIT:<p><pre><code> > "The GIF is showing the first n seconds, and the JIT just needs noticeable more time to warm up. But even at peak, AOT can outperform JIT although not by an order of magnitude of course."
</code></pre>
I asked how this was possible and he shared a great tweet by @AlinaYurenko:<p><a href="https://twitter.com/alina_yurenko/status/1582772754902052864" rel="nofollow">https://twitter.com/alina_yurenko/status/1582772754902052864</a><p><pre><code> > AOT can be faster than JIT, because:
> - in AOT 100% of the code is compiled (on JIT cold code can still be interpreted)
> - some optimizations are only possible under a closed-world assumption (AOT)
> - AOT can dedicate time and resources to perform more expensive optimizations</code></pre>