JDK-8193832 : Performance of InputStream.readAllBytes() could be improved
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 9,10
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2017-12-19
  • Updated: 2025-06-20
  • Resolved: 2017-12-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 Other
11 b01Fixed openjdk7uFixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
InputStream.readAllBytes() currently uses intermediate buffers of geometrically increasing size with a copy into each intermediate buffer at each stage. It is possible to improve the memory usage and performance using an alternate algorithm of storing a list of fixed size buffers and gathering those into a single buffer at the end.
Comments
URL: http://hg.openjdk.java.net/jdk/jdk/rev/2c1af559e922 User: bpb Date: 2017-12-22 22:10:46 +0000
22-12-2017

Performance improvement may be verified using JMH. Accuracy will be verified by the existing test test/jdk/java/io/InputStream/ReadAllBytes.java.
19-12-2017