Re: 回复:Propose to remove support for CompactStrings off

Stuart Marks stuart.marks at oracle.com
Mon Nov 10 20:09:45 UTC 2025



>> I've written up a draft JEP for deprecating the disabling of Compact Strings. 
>> There hasn't been a good term for running the system with Compact Strings 
>> disabled, so I made up a term "UTF-16-only" and used it here.
>>
>> https://openjdk.org/jeps/8371379
>>
> This is deprecating something that I assume most developers have never heard of. 
> It's important that anyone reading the JEP will quickly see that this is not 
> deprecating String, it's not dropping UTF-16, and it's not changing the String 
> constructor that take a Charset. Instead it's all about JDK internal representation 
> of String. No change needed to my code. I think the JEP needs a clear call-to- 
> action:  Audit your application launch scripts and configuration to see if you are 
> using -XX:-CompactStrings. If you are, remove it, and re-test/re-benchmark to see if 
> see if there is any impact, preferably with a recent JDK release.

Good points about what the JEP should say. I've updated it.

Pretty much every article I've seen that describes Compact Strings also mentions the 
-XX:-CompactStrings option, so the option seems fairly well known. (In addition to 
it appearing in our documentation.) However, we don't know how many people actually 
*use* the option. I suspect there might be a long tail of conservative ("don't touch 
anything!") folks who added it a long time ago out of an abundance of caution and 
forgot about it, so it would be good to get the word out as widely as possible.

s'marks



More information about the core-libs-dev mailing list