-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P5
-
None
-
Affects Version/s: 24
-
Component/s: client-libs
-
None
-
Environment:
Observed on Mac M2, OS 26.2
The sun.awt.image.PNGImageDecoder is slower than ImageIO's png decoder.
If the PNG image is 8-bit, and non-interlaced, then the code path it follows resembles:
```
while (col < width) {
if(wPixels !=null) {
<other code>
} else switch(bitDepth) {
case 8: bPixels[col+rowOffset] = rowByteBuffer[spos++];
break;
}
}
```
So we're calling `bPixels[j] = rowByteBuffer[k]` individually for width-many iterations. Using System.arraycopy or passing rowByteBuffer directly to the ImageConsumers would be noticeably faster
If the PNG image is 8-bit, and non-interlaced, then the code path it follows resembles:
```
while (col < width) {
if(wPixels !=null) {
<other code>
} else switch(bitDepth) {
case 8: bPixels[col+rowOffset] = rowByteBuffer[spos++];
break;
}
}
```
So we're calling `bPixels[j] = rowByteBuffer[k]` individually for width-many iterations. Using System.arraycopy or passing rowByteBuffer directly to the ImageConsumers would be noticeably faster
- links to
-
Review(master)
openjdk/jdk/29004