RFR: 8336831: Optimize StringConcatHelper.simpleConcat [v7]

Andrey Turbanov aturbanov at openjdk.org
Mon May 5 07:58:56 UTC 2025


On Tue, 23 Jul 2024 12:56:07 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Currently simpleConcat is implemented using mix and prepend, but in this simple scenario, it can be implemented in a simpler way and can improve performance.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   reduce change

Looks like this changes regressed behavior on long Strings:

        String r1 = "-".repeat(Integer.MAX_VALUE - 10);
        String r2 = "ы".repeat((Integer.MAX_VALUE - 10)  / 2);
        System.out.println(r1.concat(r2));

This code now throws `StringIndexOutOfBoundsException` instead of `OutOfMemoryError`

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20253#issuecomment-2850196722


More information about the core-libs-dev mailing list