Re: RFR: 8282429: StringBuilder/StringBuffer.toString() skip compressing for UTF16 strings [v2]

2022-03-08 Thread Xin Liu
On Tue, 8 Mar 2022 17:33:58 GMT, Daniel Jeliński wrote: > As for a better name for `growOnly`, something like `mayBeLatin` would better > convey the variable's purpose. What do you think? There are tricky. I need to add test to cover them. The problem comes from that this patch fails to

Re: RFR: 8282429: StringBuilder/StringBuffer.toString() skip compressing for UTF16 strings [v2]

2022-03-08 Thread Daniel Jeliński
On Mon, 7 Mar 2022 23:36:41 GMT, Xin Liu wrote: >> If AbstractStringBuilder only grow, the inflated value which has been >> encoded in UTF16 can't be compressed. >> toString() can skip compression in this case. This can save an >> ArrayAllocation in StringUTF16::compress(). >> >>

Re: RFR: 8282429: StringBuilder/StringBuffer.toString() skip compressing for UTF16 strings [v2]

2022-03-07 Thread Xin Liu
On Mon, 7 Mar 2022 12:10:51 GMT, Daniel Jeliński wrote: >> Xin Liu has updated the pull request incrementally with one additional >> commit since the last revision: >> >> make sure String(StringBuffer) is still synchronized. > > src/java.base/share/classes/java/lang/String.java line 1446: >

Re: RFR: 8282429: StringBuilder/StringBuffer.toString() skip compressing for UTF16 strings [v2]

2022-03-07 Thread Xin Liu
> If AbstractStringBuilder only grow, the inflated value which has been encoded > in UTF16 can't be compressed. > toString() can skip compression in this case. This can save an > ArrayAllocation in StringUTF16::compress(). > > java.io.BufferedRead::readLine() is a case that StringBuilder grows