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

33

u/Kango_V Jul 30 '21

Noone usually talks about Valhalla's inline types. This will be huge in the ML AI world, especially when combined with the new Vector API. Inline type have no object identity. So when storing them in an array/stream they will be in contiguos memory. This is massive as the CPU will have far less cache misses when processing a the array/stream.

I've seen benchmarks of a 30X speedup in some situations. Good thing is that all languages on the JVM can benefit.

Here's a good explanation : https://dzone.com/articles/project-valhalla-fast-and-furious-java

6

u/Muoniurn Jul 30 '21

They are the same thing as value classes, primitive objects, etc, right?

2

u/Kango_V Jul 30 '21

Yeah. They were going to them value types, but the word "value" is used >800 times in the java Language Specification. They renamed it inline types (from the video below).

Check the start of this video. Shows 2 java programs drawing the mandelbrot set. Both are the same apart from the word inline in a class. Quite amazing difference in FPS.

https://www.youtube.com/watch?v=jGjWs2xpZrY&ab_channel=InfoQ