RFR: 8358533: Improve performance of java.io.Reader.readAllLines [v3]
Brian Burkhalter
bpb at openjdk.org
Tue Jun 24 18:55:39 UTC 2025
On Wed, 18 Jun 2025 02:12:50 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8358533: Init StringBuilder to size zero; use StringBuilder.isEmpty()
>
> 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.
Irrelevant now as `eol` is gone.
> src/java.base/share/classes/java/io/Reader.java line 505:
>
>> 503: }
>> 504:
>> 505: eol = false;
>
> Suggestion:
>
> }
>
> Same as above, the local variable eol is not used after being assigned and can be removed.
Likewise irrelevant as `eol` is gone.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2164689961
PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2164690632
More information about the core-libs-dev
mailing list