RFR: 8337681: PNGImageWriter uses much more memory than necessary [v2]

Daniel Gredler duke at openjdk.org
Thu Aug 1 21:51:04 UTC 2024


> 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).

Daniel Gredler has updated the pull request incrementally with two additional commits since the last revision:

 - JDK-8337681: add tests for TYPE_4BYTE_ABGR
 - JDK-8337681: add tests for TYPE_INT_RGB

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/20432/files
  - new: https://git.openjdk.org/jdk/pull/20432/files/bf1632ac..9285d44c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20432&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20432&range=00-01

  Stats: 9 lines in 1 file changed: 8 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/20432.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20432/head:pull/20432

PR: https://git.openjdk.org/jdk/pull/20432


More information about the client-libs-dev mailing list