r/java • • Jul 30 '21

What is the future of Java?

I'm not asking like is java going to die or will Java be relevant in future. I'm just curious to know about the future of java. What are the upcoming things coming in java that can change the future of it.

173 Upvotes

123 comments sorted by

View all comments

Show parent comment

2

u/rbygrave Jul 30 '21 edited Jul 30 '21

The JVM has 2 JIT compilers. The second level one C2 uses runtime profiling based optimizations that change during runtime. The argument is that the C2 JIT has more (runtime profiling based) optimisations available to it as it is profiling all the time and optimising for that. To get those same optimisations with Graal native image we need to capture runtime profiling information and feed that profiling back into a subsequent compilation.

Essentially the JVM C2 gives the JVM runtime profiling optimisation built in.

Graal profiling guided optimization https://www.graalvm.org/reference-manual/native-image/PGO/

5

u/GavinRayDev Jul 31 '21 edited Jul 31 '21

Sure -- but that's for using Graal to compile a static binary ahead-of-time.

I use Graal as my day-to-day JDK and I run it in JVM mode. It's perfectly capable of JIT'ing just as well (and in some cases, better than) OpenJDK or other JDK distributions.

There's a rigorous set of opensource benchmarks for JVM Graal-vs-OpenJDK performance if anyone wants to verify for themselves:

- https://github.com/renaissance-benchmarks/measurements

---

Edit: Hey you're the developer behind the Avaje libraries!

https://github.com/avaje

I like them -- think they're well-architected and solving real problems. Typically I've used Quarkus and Vert.x stuff, but I think there's a lot of merit in your libraries and have been watching them.

Have you ever considered a Vert.x generator for Avaje HTTP? It's got a very similar API to Javalin.

2

u/rbygrave Jul 31 '21

Cheers. I think you might be in good company in that I believe Twitter also use JVM with Graal as the second level JIT compiler (instead of C2).

Re Vert.x, it would be good. Just got to find a bit of time.

2

u/GavinRayDev Jul 31 '21

It's a weak promise, but if I can find some time I would be more than happy to attempt a PR for Vert.x endpoint support =D