RFR: 8337681: PNGImageWriter uses much more memory than necessary

Phil Race prr at openjdk.org
Thu Aug 1 21:01:30 UTC 2024


On Thu, 1 Aug 2024 19:06:57 GMT, Daniel Gredler <duke at openjdk.org> wrote:

> At some point the `JPEGImageWriter` was optimized to reduce duplication / copying of rasters and data buffers (see `JDK-6266748`). However, `PNGImageWriter` never received a similar optimization, and is making unnecessary copies of raster and data buffers whenever PNG images are written.
> 
> Measurements: In a local test, `PNGImageWriter.write( )` and callees were initially showing up as an allocation hotspot (~400k objects / ~65 MB allocated), but after these optimizations I'm seeing much better numbers (~400 objects / ~740 KB allocated).

I'm going to put it through our internal test system.

test/jdk/javax/imageio/plugins/png/RasterReuseWriteTest.java line 49:

> 47: 
> 48:     public static void main(String[] args) throws Exception {
> 49:         test(BufferedImage.TYPE_INT_ARGB);

can you also test INT_RGB at least ?

-------------

PR Review: https://git.openjdk.org/jdk/pull/20432#pullrequestreview-2213833024
PR Review Comment: https://git.openjdk.org/jdk/pull/20432#discussion_r1700787185


More information about the client-libs-dev mailing list