RFR: 8358533: Improve performance of java.io.Reader.readAllLines
Andrey Turbanov
aturbanov at openjdk.org
Tue Jun 24 08:11:29 UTC 2025
On Wed, 18 Jun 2025 00:04:37 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Replaces the implementation `readAllCharsAsString().lines().toList()` with reading into a temporary `char` array which is then processed to detect line terminators and copy non-terminating characters into strings which are added to the list.
test/micro/org/openjdk/bench/java/io/ReaderReadAllLines.java line 61:
> 59: public List<String> readAllLines() throws IOException {
> 60: List<String> lines;
> 61: try (Reader reader = new CharArrayReader(chars);) {
Suggestion:
try (Reader reader = new CharArrayReader(chars)) {
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2163248743
More information about the core-libs-dev
mailing list