Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8268622: Performance issues in javac Name class #15470

wants to merge 2 commits into from


Copy link

@archiecobbs archiecobbs commented Aug 29, 2023

Quoting JDK-8268622:

The javadoc team has identified performance issues in the javac Name class, particularly when it is used via its CharSequence interface (JDK-8263321). The main issue there is that the CharSequence is specifically character-oriented, whereas the native form inside javac is a byte[] in modified-UTF8 form. Operations like .length() and .charAt(int) have "simple" but very inefficient implementations.

Thanks to JDK-8269957 we now have the option to swap in a String-based Name table implementation in place of the current UTF-8-based one. This does in fact improve performance of the compiler.

This patch does two things:

  • Make the String-based Name table implementation the default. The two other UTF-8-based implementations are still available via the flags -XDuseUnsharedTable=true and -XDuseSharedTable=true (the latter was the previous default). This results in a 19% speedup in my simple benchmark (see below).
  • Adds a new flag -XDinternStringTable=true, which turns on intern()ing of the Strings in the String table. This however is not the default because it results in lower performance (see below). But it's possible this could help in other scenarios so it's left in there for future testing purposes.

Here are results from the benchmark.

Benchmark                             Mode  Cnt   Score   Error  Units
JavacNameTable.testSharedTable        avgt   25  54.145 ± 1.738  ms/op
JavacNameTable.testStringTable        avgt   25  45.305 ± 0.415  ms/op
JavacNameTable.testStringTableIntern  avgt   25  50.736 ± 0.245  ms/op
JavacNameTable.testUnsharedTable      avgt   25  59.877 ± 2.503  ms/op

To reiterate: testSharedTable reflects the previous default; testStringTable reflects the new default. The other two options are available via the flags -XDinternStringTable=true and -XDuseUnsharedTable=true.


  • 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


  • JDK-8268622: Performance issues in javac Name class (Bug - P3)



Using git

Checkout this PR locally:
$ git fetch pull/15470/head:pull/15470
$ git checkout pull/15470

Update a local copy of the PR:
$ git checkout pull/15470
$ git pull pull/15470/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15470

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

Using diff file

Download this PR as a diff file:


Link to Webrev Comment

This removes the "useStringTable" flag (since it's now the default),
adds a "useSharedTable" flag (since it's no longer the default), and
adds an "internStringTable" flag enabling intern()'ing Name strings.
Copy link

bridgekeeper bot commented Aug 29, 2023

👋 Welcome back acobbs! 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 openjdk bot added the rfr Pull request is ready for review label Aug 29, 2023
Copy link

openjdk bot commented Aug 29, 2023

@archiecobbs The following label will be automatically applied to this pull request:

  • compiler

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

@openjdk openjdk bot added the compiler label Aug 29, 2023
Copy link

mlbridge bot commented Aug 29, 2023


Copy link

bridgekeeper bot commented Sep 26, 2023

@archiecobbs This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

Copy link
Contributor Author


Copy link

openjdk bot commented Sep 26, 2023

@archiecobbs Unknown command pingbot - for a list of valid commands use /help.

Copy link

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Copy link

openjdk bot commented Sep 27, 2023

@archiecobbs This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8268622: Performance issues in javac `Name` class

Reviewed-by: vromero

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 314 new commits pushed to the master branch:

  • edcc559: 8316661: CompilerThread leaks CodeBlob memory when dynamically stopping compiler thread in non-product
  • 1be3557: 8315721: fails transiently on libgraal
  • 347bd15: 8315966: Relativize initial_sp in interpreter frames
  • b24ad7c: 8316924: java/lang/Thread/virtual/stress/ times out
  • ad6df41: 8316710: Exclude java/awt/font/Rotate/
  • 45a145e: 8299915: Remove ArrayAllocatorMallocLimit and associated code
  • 50a7a04: 8316417: ObjectMonitorIterator does not return the most recent monitor and is incorrect if no monitors exists
  • fee9d33: 8293176: SSLEngine handshaker does not send an alert after a bad parameters
  • fd52be2: 8316895: SeenThread::print_action_queue called on a null pointer
  • e39197e: 8316933: RISC-V: compiler/vectorapi/ fails when using RVV
  • ... and 304 more:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@vicente-romero-oracle) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 27, 2023
Copy link
Contributor Author


@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 27, 2023
Copy link

openjdk bot commented Sep 27, 2023

Your change (at version 1dcafc7) is now ready to be sponsored by a Committer.

Copy link


Copy link

openjdk bot commented Oct 2, 2023

Going to push as commit 5c8366e.
Since your change was applied there have been 373 commits pushed to the master branch:

  • ad81abd: 8317034: Remove redundant type cast in the package
  • d7d1d42: 8316771: has not defined messages for all error codes
  • f985006: 8309356: Read files in includedir in alphanumeric order
  • a564d43: 8315692: Parallelize gc/stress/ test
  • 878d27d: 8317273: compiler/codecache/ fails transiently on Graal
  • 2637e8d: 8317314: Remove unimplemented ObjArrayKlass::oop_oop_iterate_elements_bounded
  • 8093563: 8317295: ResponseSubscribers.SubscriberAdapter should call the finisher function asynchronously
  • 516cfb1: 8316907: Fix nonnull-compare warnings
  • 5984792: 8316415: Parallelize sun/security/rsa/ subtests
  • eeb63cd: 8316361: C2: assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN with -XX:VerifyIterativeGVN=10
  • ... and 363 more:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 2, 2023
@openjdk openjdk bot closed this Oct 2, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Oct 2, 2023
Copy link

openjdk bot commented Oct 2, 2023

@vicente-romero-oracle @archiecobbs Pushed as commit 5c8366e.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
compiler integrated Pull request has been integrated
2 participants