r/programming • • Oct 21 '17

Using Java 9 Modularization to Ship Zero-Dependency Native Apps

https://steveperkins.com/using-java-9-modularization-to-ship-zero-dependency-native-apps#.Wes5IMWbUWE.reddit
310 Upvotes

109 comments sorted by

View all comments

3

u/CountyMcCounterson Oct 21 '17

Why can't they just make Java be like Go where it compiles natively but also has garbage collection? We need someone to make this into a thing so that people can optionally compile to native.

0

u/[deleted] Oct 21 '17

[deleted]

1

u/oldsecondhand Oct 22 '17

It's mostly politics and lack of push from big orgs.

4

u/Gravitationsfeld Oct 21 '17

Android did this with AOT in Android 6 or 7 (not sure which one). It's Java bytecode converted to DEX bytecode and then converted to x86/ARM on install. I think they went back to some JIT now though because of install times.

8

u/DragonSlayerC Oct 21 '17

Android 5 and 6 used that. The AOT improved performance massively and made my S4 feel like a brand new phone because it was so much faster and smoother. And everytime you updated the OS, you had to wait like 30-45 minutes for all the apps to recompile. Even with JIT (Android 2.2-4.4) they had to do that, but to a smaller extent. Starting with Android 7, what they do now is a 3-way combination. They use emulation for the simple stuff, JIT for parts that need more computation (like some loops for instance), and AOT for things that are used more often and need the most performance (with AOT, they can perform more heavy optimizations). The benefits are extremely fast install times and no need to "optimize" apps after a system update (they can just invalidate the old AOT caches) while still offering very good performance.

4

u/[deleted] Oct 21 '17

For the same reason they can't add generics to Go.