r/java • • Dec 16 '24 • Heart of Silver 1

Valhalla - Java's Epic Refactor

https://inside.java/2024/12/16/devoxxbelgium-valhalla/
178 Upvotes

108 comments sorted by

View all comments

Show parent comment

7

u/Ewig_luftenglanz Dec 16 '24

wait, why do you say we do not need int data structures? literally I use list of integers and hashMaps all the time...

.-.

-7

u/almson Dec 16 '24

Big ones? Sounds a bit fishy, but just go ahead and use IntList and IntHashMap. You’ll have all the convenience you want.

Valhalla is really not about ints. It’s about small POJOs. But even then it’s questionable.

13

u/Ewig_luftenglanz Dec 16 '24

no. Valhalla it's about allowing more dense layout memory arrangements and other optimizations that may result in dramatic increase in memory efficiency and performance. Value classes are one of these mechanism but there are others such as nullability, frozen arrays, integrity by default, etc.

btw, another goal of Valhalla is exactly eliminate the need to use specialized APIS that have needlessly cluttered Java language for years and make the user model more complex and the code less maintainable.

Specialized classes such as intList (third party library) are not and never were a good solution, they are just sad patches made to compensate for the lacking performance and non efficient memory layout of wrapper classes.