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

Shaojin Wen swen at openjdk.org
Fri May 2 07:15:45 UTC 2025


On Fri, 2 May 2025 06:41:14 GMT, Markus KARG <duke 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.

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.

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

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


More information about the core-libs-dev mailing list