logoalt Hacker News

joe_mwangiyesterday at 8:07 PM2 repliesview on HN

Yup. Totally agree. Java does needs an array of structs. Hopefully value classes will help out through flattened array. But in future, one can use value records with this library with probable zero cost allocation. But the library doesn't use any reflection calls for get and set hence high performance as a result, and using records helps a lot with escape analysis. Planning to do some serious benchmarks soon. Some preliminary tests shows it's similar to c code (example code in test package). Performance suffers if record fields are arrays due to heap allocation of arrays.


Replies

PaulHouleyesterday at 8:42 PM

The thing I coded where I felt the weight of the GC the most was a chess engine in Java that needed transposition tables. Like using regular HashMap(s) or anything similar it was too slow to really speed up the engine. If my son had stayed interested in chess I would have coded up an off-heap transposition tables but he switched to guitar which changed my side projects.

show 2 replies
fweimeryesterday at 8:48 PM

I doubt value classes will be helpful here because the array would have to be immutable. Context: https://openjdk.org/jeps/401

show 2 replies