On Sat, 21 Nov 2026 12:45:00 GMT, Liam Miller-Cushon <[email protected]> wrote:

>> Liam Miller-Cushon has updated the pull request with a new target base due 
>> to a merge or a rebase. The pull request now contains eight commits:
>> 
>>  - trailing whitespace
>>  - Merge remote-tracking branch 'origin/master' into JDK-8390026
>>  - Review feedback
>>  - More bytesCompatible coverage, special case for empty strings
>>  - Remove .swp file
>>  - Add OutOfMemoryError checks for UTF-16 encodedLength fast paths
>>  - Copyright years
>>  - 8390026: Add UTF-16 fast paths to avoid copies in String
>
> I had started looking at this as part of the investigation into JDK-8390049 
> (and #32373). I thought these optimizations might dovetail with that other 
> work, but they aren't necessary for it.
> 
> It still seems nice to provide zero-copy fast paths for UTF-16, but in 
> practice maybe it's low priority. Most of the usage of UTF-16 is probably on 
> the Java heap (as backing storage for String). Use-cases that are using 
> `MemorySegment` to copy strings off heap are probably almost always using 
> other encodings, with the exception of Windows `wchar_t`.
> 
> So if this doesn't seem worthwhile I could drop it.

@cushon, changes have two main contributions: 1) speeding up writing strings to 
foreign memory in UTF-16, and 2) allocation-free 
`String#encodedLength(Charset)` for UTF-16. They further significantly extend 
the test coverage. What would you think about splitting these two? In 
particular, `encodedLength` fast paths for UTF-16, plus associated tests, can 
be a good first step, IMHO.

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

PR Comment: https://git.openjdk.org/jdk/pull/32268#issuecomment-7273135658

Reply via email to