Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you are talking about free Java compilers that is correct.

Most commercial compilers, specially those for embedded markets always had AOT native code as deployment option.

But now the bad Oracle is finally making the AOT compiler research they got from Sun Labs available for free.



At least one free Java compiler compiles to machine code: gcj.

https://gcc.gnu.org/wiki/GCJ


Yes, but it sadly died around 2009 when most developers left the project.

GCC devs just kept it around because of the unit tests, but with GCC 7 they removed it from the distribution.


How does it compare against c/c++ in terms of performance ?


Of course it is a bit slower, as Java does not take advantage of UB nor disabling security checks for the ultimate performance.

And depending on the use case there is always the issue of value vs reference types.

But it is good enough for most use cases of typical desktop software, to the point of Oracle's long term roadmap is to rewrite the remaining C++ parts of OpenJDK in Java (Project Metropolis), using a subset they are designing called System Java.

Also can check Android flagship devices (better for performance comparison), since Android 5.0, Java is also AOT compiled to native code. Although Android 7 changes it to a mix of interpreter written in Assembly, JIT and AOT with PGO. And Android P will introduce sharing of PGO metadata across devices via Play Store.


the native executables native-image generates are usually a bit slower than hot-spot JIT'ed code (~10% on average according to one article).

they do need much less RAM and startup time is _a lot_ lower though.

here it is: "Right now peak performance is a bit worse than HotSpot, but we don’t want to advertise that (and we want to fix it of course)."

http://www.graalvm.org/docs/reference-manual/aot-compilation...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: