3 ms·
> And compressed oops were added more than a decade ago That is still recent on a Java timescale. > Hardly? They're two words a class pointer, and a "mark wor
by marginalia_nu 4y ago
> And compressed oops were added more than a decade ago
That is still recent on a Java timescale.
> Hardly? They're two words a class pointer, and a "mark words" for GC integration.
Well compare with for example C++, that can fly commando with no header, just (optional) alignment padding.
In many Java objects, the header is more than half the size of the object. That's just not good data locality. The speed-up from switching from an array of objects that has n fields to an object which has an n arrays of fields can be very significant.
- kaba0 4y agoYour array of objects are just tightly packed pointers, so the data locality (or its lack) doesn’t come from that (especially that the order of objects in memory may be different than the order in the array).
- masklinn 4y agoI'm going on a limb as they're going in every direction and trebuchet-ing goalposts, but I'd assume they're talking about using an SoA structure, so instead of having a bunch of Foo objects each with a header and, say, an `int` field (so two words of header for half a word of payload) you have a single header at the top of the array, then an int value per record in the packed array.