5 ms·
Java's value objects (inline classes) will "maximize locality of reference". [1] [1] https://openjdk.java.net/jeps/169 https://openjdk.java.net/jeps/169
by pulse7 5y ago
Java's value objects (inline classes) will "maximize locality of reference". [1]
[1] https://openjdk.java.net/jeps/169 https://openjdk.java.net/jeps/169
- hn_go_brrrrr 5y agoOr at least partially mitigate one of Java's biggest performance weaknesses.
- kllrnohj 5y agoThat draft is approaching 10 years old now. Has there been any indication of progress on this front in the recent JDK versions? The kotlin workaround hacks are clever but also nasty and having real VM support for this would be great. But it also is starting to seem like the type of issue that just won't ever be fixed, despite how hugely important it is for performance.
- pulse7 5y agoIt takes time to make such a fundamental, but backwards compatible change for 10 million developers... Nobody wants Python 2 -> 3...
- kllrnohj 5y agoIt's a new keyword & bytecode feature, so there's no backwards compatible risks to it. Nobody's existing code would be impacted as nobody's existing code is using user-defined value types in the byte code. It looks like there were some experiments and prototyping out of Valhalla from 2014-2018 (including a publicly available build: https://jaxenter.com/java-value-type-163446.html https://jaxenter.com/java-value-type-163446.html ), but there doesn't seem to be any updates since then
- Sindisil 5y ago> there doesn't seem to be any updates since then Oracle (Brian Goetz in particular) regularly gives talks and interviews and publishes updates. There was even a link on this site a couple weeks ago: https://news.ycombinator.com/item?id=28364500 https://news.ycombinator.com/item?id=28364500
- lsuresh 5y agoIt's being actively worked on [1, 2]. [1] https://github.com/openjdk/valhalla/ https://github.com/openjdk/valhalla/ [2] https://mail.openjdk.java.net/pipermail/valhalla-dev/ https://mail.openjdk.java.net/pipermail/valhalla-dev/
- kaba0 5y agoBut introducing such a large scale change to the JVM has to be well thought out, especially when it will get to live for decades.
- pulse7 5y agoThey don't want to introduce the a third type (next to primitive types and reference types). They are unifying the type system so that after this change we will also get universal generics so that List<T> could be List<int>, List<Person> and also List<Person.val> (where Person.val is an inlined class without identity).