On Fri, 10 Jul 2026 14:45:51 GMT, Andy Goryachev <[email protected]> wrote:
>> https://wiki.openjdk.org/spaces/HotSpot/pages/11829259/CompressedOops > > replace with "object pointers" maybe? It turns out my original calculation was wrong. It would occupy 28 bytes: - 12 bytes object header - 4 bytes array length - 3 * 4 bytes for the 3 elements (4 bytes because of compressed oops) Total 28 bytes (becomes 32 bytes for 8 byte alignment for 64-bit machines) However... compact object headers to the rescue, which will be on by default from Java 27, and any space conscious user will be leaving it on (if not, we don't need to try to optimize space either). The calculation then becomes: - 8 bytes object header - 4 bytes array length - 3 * 4 bytes for the 3 elements (4 bytes because of compressed oops) Total 24 bytes, no alignment penalty So I think going with 3 as default is still good (as most lists will be small), and then going to 7 is excellent as that would be 40 bytes (also no alignment issues). Similar for 13. Starting from 22 we waste a bit of space, but at that point the list is so large that it hardly matters anymore. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1081#discussion_r3562119544
