RFR: 8358533: Improve performance of java.io.Reader.readAllLines
Shaojin Wen
swen at openjdk.org
Wed Jun 18 02:15:39 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.
src/java.base/share/classes/java/io/Reader.java line 492:
> 490: // Buffer content consumed so reload it.
> 491: if ((n = read(cb, 0, cb.length)) < 0) {
> 492: eos = eol = true;
Suggestion:
eos = true;
The local variable eol assignment here is not used and can be removed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2153483905
More information about the core-libs-dev
mailing list