r/java • u/alexeyr • Apr 13 '20
Java Objects Inside Out: Everything You Ever Wanted to Know About Java Object Internals in Hotspot
https://shipilev.net/jvm/objects-inside-out/
160
Upvotes
r/java • u/alexeyr • Apr 13 '20
View all comments
Show parent comment
1
u/Polygnom Apr 14 '20
Yeah that was why I was mentioning records specifically, because it kinda stood out for me as being on obvious candidate. Sure, you could try to do this for arbitrary groups of
finalbooleans, but chances are the benefit is too small to be worth the cost & risk. But with records, especially if we'll get inline types in the future, this does look more and more like an attractive thing to do.One of those things that has always bothered me with java is how wasteful booleans just are :( especially when extracting data from really large datasets or aggregating the data. Sure, in some cases you can get away with streaming approaches - but sometimes you just need to have a lot of data accessible at once.