> When decoding an uninterlaced 8-bit PNG image, the PNGImageDecoder is 
> basically copying one byte at a time.
> 
> This PR uses System.arraycopy instead, and it shows approx a 10% improvement.
> 
> This graph shows the time it takes different decoders to convert a byte array 
> into a BufferedImage as the size of the PNG image increases:
> 
> <img width="596" height="366" alt="Screenshot 2025-12-27 at 9 14 19 PM" 
> src="https://github.com/user-attachments/assets/73583cb2-eda0-47a8-b818-735a1835f1e8";
>  />
> 
> (This originally came to my attention when looking at an image in Java 1.8. 
> There the ImageConsumer model took approx 400% longer than ImageIO. I was 
> happy to see in recent JDKs that gap narrowed significantly, but there was 
> still a noticeable 10% discrepancy.)
> 
> I haven't tried submitting a performance enhancement PR before; I'm not sure 
> if this issue meets this group's threshold for being worth addressing. And if 
> it does: I'm not sure how to structure a unit test for it.

Jeremy Wood has updated the pull request incrementally with eight additional 
commits since the last revision:

 - 8374377: trivial line break formatting
 - 8374377: test orig img against decoded img
   
   This is in response to:
   https://github.com/openjdk/jdk/pull/29004#discussion_r2657780639
 - 8374377: changing Error to RTE
   
   This is in response to:
   https://github.com/openjdk/jdk/pull/29004#discussion_r2657765027
 - 8374377: changing Error to RTE
   
   This is in response to:
   https://github.com/openjdk/jdk/pull/29004#discussion_r2657763413
 - 8374377: changing classname
   
   This is in response to:
   hhttps://github.com/openjdk/jdk/pull/29004#discussion_r2657759447
 - 8374377: removing correctness check
   
   The PNGImageDecoder_8bit_performance.java /PngImageDecoder8BitTest.java 
class will test correctness.
   
   This is in response to:
   https://github.com/openjdk/jdk/pull/29004#discussion_r2657715697
 - 8374377: adding imports
   
   This is in response to:
   https://github.com/openjdk/jdk/pull/29004#discussion_r2657043086
 - 8374377: fixing package
   
   This is in response to:
   https://github.com/openjdk/jdk/pull/29004#discussion_r2657041047

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/29004/files
  - new: https://git.openjdk.org/jdk/pull/29004/files/313cf437..c609b00e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29004&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29004&range=02-03

  Stats: 503 lines in 3 files changed: 225 ins; 277 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/29004.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29004/head:pull/29004

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

Reply via email to