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

Closed
wants to merge 2 commits into from

Conversation

archiecobbs
Copy link
Contributor

@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 JavacNameTable.java 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.


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

Issue

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

Reviewers

Reviewing

Using git

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

Update a local copy of the PR:
$ git checkout pull/15470
$ git pull https://git.openjdk.org/jdk.git 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:
https://git.openjdk.org/jdk/pull/15470.diff

Webrev

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.
@bridgekeeper
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
@openjdk
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 compiler-dev@openjdk.org label Aug 29, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 29, 2023

Webrevs

@bridgekeeper
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!

@archiecobbs
Copy link
Contributor Author

/pingbot

@openjdk
Copy link

openjdk bot commented Sep 26, 2023

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

Copy link
Contributor

@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.

lgtm

@openjdk
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 CONTRIBUTING.md 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: CloseRace.java#id0 fails transiently on libgraal
  • 347bd15: 8315966: Relativize initial_sp in interpreter frames
  • b24ad7c: 8316924: java/lang/Thread/virtual/stress/ParkALot.java times out
  • ad6df41: 8316710: Exclude java/awt/font/Rotate/RotatedTextTest.java
  • 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/VectorCastShape128Test.java fails when using RVV
  • ... and 304 more: https://git.openjdk.org/jdk/compare/5cbff2460812fee707f9d96ab00a628d1ce3fbef...master

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
@archiecobbs
Copy link
Contributor Author

/integrate

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

openjdk bot commented Sep 27, 2023

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

@vicente-romero-oracle
Copy link
Contributor

/sponsor

@openjdk
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 java.util.stream package
  • d7d1d42: 8316771: Krb5.java has not defined messages for all error codes
  • f985006: 8309356: Read files in includedir in alphanumeric order
  • a564d43: 8315692: Parallelize gc/stress/TestStressRSetCoarsening.java test
  • 878d27d: 8317273: compiler/codecache/OverflowCodeCacheTest.java 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/SignedObjectChain.java subtests
  • eeb63cd: 8316361: C2: assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN with -XX:VerifyIterativeGVN=10
  • ... and 363 more: https://git.openjdk.org/jdk/compare/5cbff2460812fee707f9d96ab00a628d1ce3fbef...master

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
@openjdk
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
Labels
compiler compiler-dev@openjdk.org integrated Pull request has been integrated
2 participants