On Hacker News
Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28
Read the full article on jvm-weekly.com ↗93
points
50
comments
2
notable voices
The 5-second version
- Project Valhalla's first deliverable, JEP 401 (Value Classes and Objects), is targeting JDK 28 as a preview feature disabled by default after a decade of development.
- Value classes aim to let developers write normal classes that the JVM can optimize to be as memory-efficient and performant as primitive types like int.
- The core problem being solved is Java's pointer-based object model, which causes pointer indirection, object headers, heap allocation, and poor cache locality at scale.
- Escape analysis exists as an existing optimization but is unreliable and fragile, making it unsuitable as a foundation for predictable performance.
- This JDK 28 release is explicitly only the first part of Valhalla, with more features still to come, despite representing a massive 197,000+ line code change.
Top voices
Verbatim comments from the thread's most notable / highest-karma participants.
> is it necessary for the performance boost and de-fluffing the objects? Yes. The one part of the JVM GC that can't run concurrently is heap compaction; objects that can be moved by copying and then deleting would be a huge help for that. And it would be awkward to say the object has an identity but can't be wait/notify'd, at which point you need somewhere for the monitor to go. > Does this happen in actuality? One would assume the allocator tries to put stuff sequentially on the heap? Yes. O…Read on HN ↗
There’s nothing wrong with having non-normalized representations, that’s why there is equals(). For example, you might have a value class for representing (limited-precision) fractions using two longs internally, for the numerator and denominator. For efficiency trade-off reasons, you don’t want to always shorten the fraction. But now client code can distinguish 2/3 from 4/6 using ==. Scenarios of that sort are conceivable where this actually leaks sensitive information. In any case, it create…Read on HN ↗
andyjohnson017.6k karma
> The whole attitude and process around this and the other topics gives me very little faith that Java can be steered in a sensible direction here. I agree. The stewardship of Java seems rather lacking - particularly when compared to that of .net, where MS etc. mostly seemed to make the correct decisions from the start. Does Java even have any value or mindshare at Oracle nowadays? The company seems to be a datacentre/compute business at this point, with appendiges for its legacy activities an…Read on HN ↗
usrusr11.2k karma
Value types are a concept very far away from the "magic black box organism" school of OOP thinking. It's not a novel way of doing classic OOP (does anyone still do that?), it's a way for a language born in OOP ideology get one step further into the post-OOP world.Read on HN ↗