Skip to content

8306374: (bf) Improve performance of DirectCharBuffer::append(CharSequence[,int,int]) #13522

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

Closed
wants to merge 7 commits into from

Conversation

bplb
Copy link
Member

@bplb bplb commented Apr 19, 2023

Use getChars() to copy characters to an intermediate local char[] array and then putArray() to copy the chars into the buffer itself.


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-8306374: (bf) Improve performance of DirectCharBuffer::append(CharSequence[,int,int])

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13522

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 19, 2023

👋 Welcome back bpb! 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 Apr 19, 2023
@bplb
Copy link
Member Author

bplb commented Apr 19, 2023

Appending a sequence of 32768 characters gave the following results:

Before

Benchmark                                         Mode  Cnt      Score      Error  Units
CharBufferAppend.appendStringBufferToDirect      thrpt   10  42746.409 ±  436.898  ops/s
CharBufferAppend.appendStringBuilderToDirect     thrpt   10  39007.579 ±  934.130  ops/s
CharBufferAppend.appendStringToDirect            thrpt   10  47820.006 ± 1142.298  ops/s
CharBufferAppend.appendSubStringBufferToDirect   thrpt   10  79981.671 ± 2248.619  ops/s
CharBufferAppend.appendSubStringBuilderToDirect  thrpt   10  82032.943 ±  890.607  ops/s
CharBufferAppend.appendSubStringToDirect         thrpt   10  80458.162 ± 1396.552  ops/s

After

Benchmark                                         Mode  Cnt       Score      Error  Units
CharBufferAppend.appendStringBufferToDirect      thrpt   10   41448.953 ± 1176.265  ops/s
CharBufferAppend.appendStringBuilderToDirect     thrpt   10  317041.262 ± 4242.432  ops/s
CharBufferAppend.appendStringToDirect            thrpt   10   47376.189 ±  479.143  ops/s
CharBufferAppend.appendSubStringBufferToDirect   thrpt   10  551124.908 ± 4773.753  ops/s
CharBufferAppend.appendSubStringBuilderToDirect  thrpt   10  616143.045 ± 9020.091  ops/s
CharBufferAppend.appendSubStringToDirect         thrpt   10  605963.509 ± 6222.007  ops/s

Throughput is either effectively unchanged or increased by a factor of 6 to 8.

@openjdk
Copy link

openjdk bot commented Apr 19, 2023

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

  • nio

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 nio nio-dev@openjdk.org label Apr 19, 2023
@mlbridge
Copy link

mlbridge bot commented Apr 19, 2023

Webrevs

@openjdk
Copy link

openjdk bot commented Apr 26, 2023

@bplb 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:

8306374: (bf) Improve performance of DirectCharBuffer::append(CharSequence[,int,int])

Reviewed-by: liach, alanb

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 16 new commits pushed to the master branch:

  • a18191f: 8302328: [s390x] Simplify asm_assert definition
  • 9bc6a21: 8306033: Resolve multiple definition of 'throwIOException' and friends when statically linking with JDK native libraries
  • 35e8023: 8306872: Rename Node_Array::Size()
  • 2e340e8: 8233725: ProcessTools.startProcess() has output issues when using an OutputAnalyzer at the same time
  • 35e7bc2: 8306855: [s390x] fix difference in abi sizes
  • 9ad6dc8: 8306774: Make runtime/Monitor/GuaranteedAsyncDeflationIntervalTest.java more reliable
  • c5910fa: 8306749: Make CardTable::invalidate non-virtual
  • 86f41a4: 8306735: G1: G1FullGCScope remove unnecessary member _explicit_gc
  • d747698: 8306823: Native memory leak in SharedRuntime::notify_jvmti_unmount/mount.
  • 8d89992: 8298189: Regression in SPECjvm2008-MonteCarlo for pre-Cascade Lake Intel processors
  • ... and 6 more: https://git.openjdk.org/jdk/compare/00b1eacad6ae2d5ea5afb1de506768e9ab960743...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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 26, 2023
@bplb
Copy link
Member Author

bplb commented Apr 26, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Apr 26, 2023

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

  • a18191f: 8302328: [s390x] Simplify asm_assert definition
  • 9bc6a21: 8306033: Resolve multiple definition of 'throwIOException' and friends when statically linking with JDK native libraries
  • 35e8023: 8306872: Rename Node_Array::Size()
  • 2e340e8: 8233725: ProcessTools.startProcess() has output issues when using an OutputAnalyzer at the same time
  • 35e7bc2: 8306855: [s390x] fix difference in abi sizes
  • 9ad6dc8: 8306774: Make runtime/Monitor/GuaranteedAsyncDeflationIntervalTest.java more reliable
  • c5910fa: 8306749: Make CardTable::invalidate non-virtual
  • 86f41a4: 8306735: G1: G1FullGCScope remove unnecessary member _explicit_gc
  • d747698: 8306823: Native memory leak in SharedRuntime::notify_jvmti_unmount/mount.
  • 8d89992: 8298189: Regression in SPECjvm2008-MonteCarlo for pre-Cascade Lake Intel processors
  • ... and 6 more: https://git.openjdk.org/jdk/compare/00b1eacad6ae2d5ea5afb1de506768e9ab960743...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 26, 2023

@bplb Pushed as commit d0e8aec.

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

@bplb bplb deleted the DirectCharBufferAppend-8306374 branch April 26, 2023 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated nio nio-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

4 participants