2 ms·
You make a blanket statement as if it is never (or not even often) true that a JIT that has seen the actual runtime usage patterns can beat C++ and other static
by DamonHD 4y ago
You make a blanket statement as if it is never (or not even often) true that a JIT that has seen the actual runtime usage patterns can beat C++ and other static compilation. Maybe you haven't seen it. That isn't the same.
One advantage of JIT (eg Java) over (eg C++) static AOT compilation is not needing to build (and test) binaries for each target, nor have the bloat that a static compilation can bring, especially with decent debug support or heavy optimisation. (I'm remembering impossible 2GB library binaries back in the late 90s IIRC.)
JITs support running cross-platform with a single often relatively-small image, faster than a pure interpreter such as Python or shell, often much faster.
I regularly build a small app and test it on my MacBook (Air M1), ship it to my RPi (2+) and run it unchanged on a somewhat different JDK version, and it's plenty fast enough. No cross-compilation needed, no build environment on the target needed.]
And that's before gettin into things that AOT cannot easily do, such as dynamically load or even generate new code at run-time.