8379630: Add JMH benchmark to measure the overhead of using captured call state#30719
8379630: Add JMH benchmark to measure the overhead of using captured call state#30719Arraying wants to merge 3 commits intoopenjdk:masterfrom
Conversation
|
/cc core-libs hotspot |
|
👋 Welcome back phubner! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@Arraying The |
|
@Arraying To determine the appropriate audience for reviewing this pull request, one or more labels corresponding to different subsystems will normally be applied automatically. However, no automatic labelling rule matches the changes in this pull request. In order to have an "RFR" email sent to the correct mailing list, you will need to add one or more applicable labels manually using the /label pull request command. Applicable Labels
|
| @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) | ||
| @State(Scope.Benchmark) | ||
| @OutputTimeUnit(TimeUnit.NANOSECONDS) | ||
| @Fork(value = 3, jvmArgs = {"--add-exports=java.base/jdk.internal.foreign=ALL-UNNAMED", |
There was a problem hiding this comment.
The add exports seems not necessary; you are not using anything from this package.
Hi all,
The Java FF&M API includes functionality to both initialize and read from thread-local data prior to and immediately after downcalls, respectively, through the
Linker.Option::captureCallStateAPI. This is useful, as an example, when setting or capturingerrnowhen interfacing with C functions. However, using this linker option introduces some invocation overhead at runtime.This RFE introduces a JMH microbenchmark which quantifies this overhead. A simple downcall to
strtolis measured with and without call state capturing.Testing: GHA for sanity testing.
Benchmarking Results
I have executed this benchmark on Oracle-supported platforms, the results can be found below. For each platform, I've done two trials corresponding to different JDKs: one being the current HEAD ("current", based on 8357de8), and one with JDK-8378559 reverted ("legacy", revert commit on top of 8357de8). This one-off experiment is insightful since JDK-8378559 increased the overhead of downcalls using state capturing by introducing thread-local data initialization. The performance impact of this change was previously unquantified.
Linux x64
Current:
Legacy:
Linux AArch64
Current:
Legacy:
macOS x64
Current:
Legacy:
macOS AArch64
Current:
Legacy:
Windows x64
Current:
Legacy:
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30719/head:pull/30719$ git checkout pull/30719Update a local copy of the PR:
$ git checkout pull/30719$ git pull https://git.openjdk.org/jdk.git pull/30719/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30719View PR using the GUI difftool:
$ git pr show -t 30719Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30719.diff
Using Webrev
Link to Webrev Comment