I had a look at the statistics for The Main Thread to get a better idea of which pieces interest you most. The exoplanet dashboard in October and the Quarkus UI cards in November both stood out among readers who clicked links in more than one post. With either of those you could run the example, change a little Java and see what happened, so I built this first subscriber-only piece around an experiment you can try the same way. It’s still free. You just have to subscribe to read the full lab and download the code.
For the example itself, I went back to the little Quarkus application that turns a photo into pixel art. Its filters read a pixel as an int, which is quite convenient because the alpha, red, green and blue channels take one byte each. A 4K frame has 3,840 × 2,160 pixels, so at four bytes per pixel the colors take up about 31.6 MiB. Give the JVM a 64 MiB heap and there ought to be plenty of room for that picture.
Now suppose I give the pixel a name in Java. A Pixel record with a single int field seems like a fairly modest change to make to an image filter. I can also add the value keyword from Project Valhalla, which gives HotSpot another way to store those pixels. It’s the same picture in all three cases, but how much of that first calculation carries over?
Take a guess before you download the code. If each array gets its own JVM and the same 64 MiB heap, which ones can store 8,294,400 pixels and read them all back? Keep your picks somewhere. You can ask HotSpot to show you the layout if one of the answers turns out a little differently than you expected.



