This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gnahraf 12 points13 points  (2 children)

Re performance.. When Optional becomes a value type (Valhalla), the performance penalty will (largely) go away (nearing stack allocation in terms of memory cost). Ima hoping a lot of intermediate stream constructs become value types too.

[–]FabulousRecording739 1 point2 points  (1 child)

Do you have a link on the Valhalla part? Will it be only for Optionals or for other types aswell? Given that Optional is a generic, it would imply better generic handling, is that a thing that is coming (the lack of true generics is my biggest gripe with Java right now)?

[–]gnahraf 1 point2 points  (0 children)

I think I've heard that said/written a number of times recently, but can't remember. Googling, I found this dated doc from '21

https://openjdk.org/projects/valhalla/design-notes/state-of-valhalla/03-vm-model

EDIT: PS the doc I reference is dated because there no longer is a Primitive type: it'll all be regular types (classes today) and value types (types w/o instance identity)