Skip to content

Conversation

@wenshao
Copy link
Contributor

@wenshao wenshao commented Oct 25, 2025

Initially, the option to disable CompactStrings was provided for performance reasons.

However, with some optimizations for UTF8 scenarios and Latin1, disabling CompactStrings no longer has any performance benefits. I propose removing the related code to make it simpler and easier to maintain.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27988/head:pull/27988
$ git checkout pull/27988

Update a local copy of the PR:
$ git checkout pull/27988
$ git pull https://git.openjdk.org/jdk.git pull/27988/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27988

View PR using the GUI difftool:
$ git pr show -t 27988

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27988.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 25, 2025

👋 Welcome back swen! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 25, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Oct 25, 2025

@wenshao The following labels will be automatically applied to this pull request:

  • core-libs
  • graal
  • hotspot
  • i18n
  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@ExE-Boss
Copy link

Note that there’s currently a bug with CompactStrings and StringBuilder which can result in a UTF‑16 inflated String being created with only Latin1 characters, which I mentioned in:

This introduced a bug where the following now incorrectly returns false with ‑XX:⁠+CompactStrings as it produces an inflated String containing only Latin1 characters:

new StringBuilder()
	// insert Latin1 sub-slice "foo" of UTF-16 string:
	.insert(0, "foo \uF000", 0, 3)
	.toString()
	.equals("foo");

Such a String can cause many weird bugs.

@wenshao wenshao changed the title Propose to remove support for CompactStrings off Remove support for CompactStrings off Oct 26, 2025
@wenshao
Copy link
Contributor Author

wenshao commented Oct 26, 2025

Note that there’s currently a bug with CompactStrings and StringBuilder which can result in a UTF‑16 inflated String being created with only Latin1 characters, which I mentioned in:

This introduced a bug where the following now incorrectly returns false with ‑XX:⁠+CompactStrings as it produces an inflated String containing only Latin1 characters:

new StringBuilder()
	// insert Latin1 sub-slice "foo" of UTF-16 string:
	.insert(0, "foo \uF000", 0, 3)
	.toString()
	.equals("foo");

Such a String can cause many weird bugs.

this should be another PR, fixed in the insert method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants