On Fri, 19 Jul 2024 19:18:43 GMT, Shaojin Wen <d...@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: > > share newArray As annoying and risky as this first appeared, this patch is actually in quite good shape: The usage of `getBytes` is similar to those in StringUTF16, and there's no reason to further complicate this by splitting the handling into StringLatin1 and StringUTF16. 👍 Another question for you: can you check out the original form over here too? https://github.com/openjdk/jdk/commit/781fb29580b08fa659019a2da09488ee4711c017#diff-f8131d8a48caf7cfc908417fad241393c2ef55408172e9a28dcaa14b1d73e1fbL1968-L1981 `simpleConcat` is required to create new String objects and `String.concat` can just return the argument/original when one part is not empty. Is there any value to extract a common `doConcat` handling both non-empty strings, called by both methods after handling the empty cases? ------------- PR Comment: https://git.openjdk.org/jdk/pull/20253#issuecomment-2240077201