Permisuan
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
sanitation@lemmy.today to Java@programming.dev · 6 days ago

Value Classes Still Need Compiler Sympathy

johan-sjolen.github.io

external-link
message-square
0
fedilink
1
external-link

Value Classes Still Need Compiler Sympathy

johan-sjolen.github.io

sanitation@lemmy.today to Java@programming.dev · 6 days ago
message-square
0
fedilink
This post discusses preview features in JDK 28\nJEP 401, a major Valhalla milestone, has been integrated as a preview feature in JDK 28. This is very exciting, as value classes increase both our ability to communicate the semantics of our programs to others and the optimization opportunities available to the JVM.\nHowever, I have seen people online essentially taking a “Value all the classes!” approach to this. I worry that there is a belief that ordinary classes give you a floor on performance, and that value classes will do their best to raise you above that floor, but won’t ever take you below it. Unfortunately, that is not true. A well-intentioned program may put the JVM into a situation where a flattened representation is faster for some methods, and a reference representation is faster for others. When these methods interact, the JVM is forced to convert between the two representations. I want value classes to be more than just magic, so today I am going to show you what the JVM is capable of right now, and where its limitations are. I hope that with this you’ll have some context for reasoning about the code that you (or your AI agent) write.\n
alert-triangle
You must log in or register to comment.

Java@programming.dev

java@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !java@programming.dev

For discussing Java, the JVM, languages that run on the JVM, and other related technologies.

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 12 users / day
  • 0 users / week
  • 0 users / month
  • 0 users / 6 months
  • 1 local subscriber
  • 2.04K subscribers
  • 50 Posts
  • 0 Comments
  • Modlog
  • mods:
  • Ategon@programming.dev
  • JackbyDev@programming.dev
  • Tom@programming.dev
  • UI: 0.19.5
  • BE: 0.19.19
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org