news.volyx.in

Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28 (jvm-weekly.com)

658 points by philonoist · 23 days ago · 447 comments on HN

Article summary

Project Valhalla, a decade-long effort to improve Java's performance, has finally been integrated into the OpenJDK repository and is targeting JDK 28. The project aims to allow developers to write classes that work like primitives, eliminating the need for pointer indirection and improving memory density. This is achieved through the introduction of value classes, which are declared with the 'value' modifier and have no identity. The integration is a significant milestone, but the feature is still in preview and disabled by default.

Main themes

  • Project Valhalla
  • Java performance
  • Value classes
  • Language design
  • Backward compatibility
  • Comparison with .NET

What commenters say

  • The integration of Project Valhalla into JDK 28 is a significant achievement, but its impact on Java's performance remains to be seen.
  • The design of value classes in Java is overly complex and could have been simplified by adopting a more straightforward approach, similar to .NET's structs.
  • Java's backward compatibility requirements have hindered the development of value classes, making it difficult to introduce new features without breaking existing code.
  • The comparison between Java and .NET is unfair, as .NET had the advantage of being designed later and learning from Java's mistakes.
  • The introduction of value classes in Java will require significant changes to existing code and may not be widely adopted due to the complexity of the new feature.
  • The decision to make value classes immutable by default is a good design choice, as it avoids tearing issues and allows for optimization under the hood.
  • The .NET ecosystem is not necessarily superior to Java's, and the latter has its own strengths, such as a huge open-source ecosystem and culture.
  • The development of Project Valhalla has been hindered by Oracle's shifting priorities and lack of investment in Java, leading to a perception that the company is no longer committed to the language.