Perhaps things will change as ahead-of-time compilation for Java becomes more mainstream
I understand JIT compilation is pretty advanced these days. Wouldn't this go against it? Or maybe the approach can be mixed, but if so, you'd still need the runtime environment ("the JVM").
A mixed approach can be done, yes. If dynamic classloading is needed, you need to bundle a JIT as well (or at least a traditional interpreter). Excelsior JET has used this hybrid approach for years. [0] I imagine it should be possible to omit the JIT if it can be determined that it's not needed.
If you ever try to write a bash script that calls a Java program in a tight loop, you'll know the limitations of a fat interpreting runtime with JIT compilation. Another relevant use case is the Stateless Lambda server-side architecture.
I believe Java (OpenJDK at least) is slow to start even if you disable the JIT and go with pure interpretation, and even if you disable runtime bytecode verification. It's just generally heavyweight and slow to get off the ground.
I imagine JIT compilation should help with this, as you suggest.
Comments
I understand JIT compilation is pretty advanced these days. Wouldn't this go against it? Or maybe the approach can be mixed, but if so, you'd still need the runtime environment ("the JVM").
A mixed approach can be done, yes. If dynamic classloading is needed, you need to bundle a JIT as well (or at least a traditional interpreter). Excelsior JET has used this hybrid approach for years. [0] I imagine it should be possible to omit the JIT if it can be determined that it's not needed.
[0] https://en.wikipedia.org/wiki/Excelsior_JET
If you ever try to write a bash script that calls a Java program in a tight loop, you'll know the limitations of a fat interpreting runtime with JIT compilation. Another relevant use case is the Stateless Lambda server-side architecture.
I believe Java (OpenJDK at least) is slow to start even if you disable the JIT and go with pure interpretation, and even if you disable runtime bytecode verification. It's just generally heavyweight and slow to get off the ground.
I imagine JIT compilation should help with this, as you suggest.
Oops, too late to edit, but I meant ahead-of-time compilation should help with this