3 ms·
I agree. If Java’s already as fast as native, as people keep claiming, why all the effort to compile to native code? This feels like an old solution to an old p
by maxlybbert 6y ago
I agree. If Java’s already as fast as native, as people keep claiming, why all the effort to compile to native code? This feels like an old solution to an old problem.
- fotad 6y agoSmall size since it does not need JRE, fast launching time, it's good for short living app, something like pay as you go cloud computing...
- stefs 6y agothere is no single "native". you have different compilers for different languages. "native" (i.e. compiled) PHP is still slow. some interpreted languages are insanely fast. in theory, JITed languages could be faster than AOT-compiled languages; in practice that's rarely the case (https://wiki.c2.com/?SufficientlySmartCompiler https://wiki.c2.com/?SufficientlySmartCompiler). hotspot is a just-in-time compiler, i.e. it's still compiled to native code; just not the whole codebase at once and prior to startup, but depending on usage statistics which are gathered during interpreted execution (hot code paths). you can leverage similar statistics in AOT with profile guided optimization. as it stands, native_image starts a lot quicker, needs far less disk space and uses a lot less ram, which is important for CLI- and containerized apps. but it's slightly slower than hotspot, doesn't support dynamic code loading and of course you'll need to recompile your app for different platforms and architectures.