RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v4]

Shaojin Wen swen at openjdk.org
Sat May 17 14:58:53 UTC 2025


On Fri, 2 May 2025 07:13:21 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>>> ```java
>>> >         char[] ca = new char[end - off];
>>> ```
>>> 
>>> Your code here has a memory allocation, which may cause slowdown
>> 
>> This is exactly what I wanted to express with my posting.
>
>> > ```java
>> > >         char[] ca = new char[end - off];
>> > ```
>> > 
>> > 
>> >     
>> >       
>> >     
>> > 
>> >       
>> >     
>> > 
>> >     
>> >   
>> > Your code here has a memory allocation, which may cause slowdown
>> 
>> This is exactly what I wanted to express with my posting.
> 
> I agree with you that this PR can improve the performance of Reader's method ` int read(char[] cbuf, int off, int len)`, but may not help the performance of Reader::getChars.

> @wenshao Why did you remove UTF16::compress from your proposal? Wasn't it providing the expected benefit?

StringUTF16::compress has been added in PR #24967

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

PR Comment: https://git.openjdk.org/jdk/pull/24773#issuecomment-2888440484


More information about the core-libs-dev mailing list