RFR: 8358533: Improve performance of java.io.Reader.readAllLines [v9]
Brian Burkhalter
bpb at openjdk.org
Tue Jul 1 16:37:45 UTC 2025
On Tue, 1 Jul 2025 15:10:33 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> test/jdk/java/io/Reader/ReadAll.java line 117:
>>
>>> 115: sb.setLength(0);
>>> 116: }
>>> 117:
>>
>> Does one of these cases result in a *very very long line without a terminator"; something that would trigger the limits of ArraySupport.newLength at or near Integer.MAX_VALUE - 8?
>
> I don't know, but I doubt it. I will look into adding something.
With this change
--- a/test/jdk/java/io/Reader/ReadAll.java
+++ b/test/jdk/java/io/Reader/ReadAll.java
@@ -115,6 +115,8 @@ public static void setup() throws IOException {
sb.setLength(0);
}
+ strings.add(" ".repeat(Integer.MAX_VALUE/2));
+
the limit is reached but it doubles the test run time, at least on an M4 Max.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2178054383
More information about the core-libs-dev
mailing list