Skip to content

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Sep 19, 2025

Hi all,

please review this change to G1 commit/uncommit to merge commit/uncommit calls to the operating system as much as possible. This significantly improves startup performanc

Performance results before/after on Zen3 processor for a "HelloWorld" application:

 $ hyperfine -w 10 -r 10 "baseline/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello"
Benchmark 1: baseline/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello
  Time (mean ± σ): 16.4 ms ± 0.4 ms [User: 11.0 ms, System: 14.4 ms]
  Range (min … max): 15.7 ms … 16.8 ms 10 runs

$ hyperfine -w 10 -r 10 "baseline/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello"
Benchmark 1: baseline/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello
  Time (mean ± σ): 24.7 ms ± 0.4 ms [User: 10.7 ms, System: 22.7 ms]
  Range (min … max): 24.2 ms … 25.4 ms 10 runs

My reimplementation of JDK-8071277 does show improvements here:

$ hyperfine -w 10 -r 10 "changes/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello"
Benchmark 1: changes/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello
  Time (mean ± σ): 15.9 ms ± 0.4 ms [User: 11.9 ms, System: 13.1 ms]
  Range (min … max): 15.4 ms … 16.7 ms 10 runs

$ hyperfine -w 10 -r 10 "changes/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello"
Benchmark 1: changes/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello
  Time (mean ± σ): 19.7 ms ± 0.3 ms [User: 11.3 ms, System: 17.4 ms]
  Range (min … max): 19.2 ms … 20.1 ms 10 runs

I.e., depending on actually committed heap size (-Xms), reduction of startup time by 20% or so in above cases.

Testing: tier1-5, gha

Thanks,
Thomas


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-8071277: G1: Merge commits and uncommits of contiguous memory (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27381

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 19, 2025

👋 Welcome back tschatzl! 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 Sep 19, 2025

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

@openjdk openjdk bot changed the title 8071277 8071277: G1: Merge commits and uncommits of contiguous memory Sep 19, 2025
@openjdk
Copy link

openjdk bot commented Sep 19, 2025

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

  • hotspot-gc

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.

Hi all,

  please review this change to G1 commit/uncommit to merge commit/uncommit calls to the operating system as much as possible. This significantly improves startup performanc

Performance results before/after on Zen3 processor for a "HelloWorld" application:

```
 $ hyperfine -w 10 -r 10 "baseline/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello"
Benchmark 1: baseline/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello
  Time (mean ± σ): 16.4 ms ± 0.4 ms [User: 11.0 ms, System: 14.4 ms]
  Range (min … max): 15.7 ms … 16.8 ms 10 runs

$ hyperfine -w 10 -r 10 "baseline/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello"
Benchmark 1: baseline/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello
  Time (mean ± σ): 24.7 ms ± 0.4 ms [User: 10.7 ms, System: 22.7 ms]
  Range (min … max): 24.2 ms … 25.4 ms 10 runs

My reimplementation of JDK-8071277 does show improvements here:

$ hyperfine -w 10 -r 10 "changes/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello"
Benchmark 1: changes/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello
  Time (mean ± σ): 15.9 ms ± 0.4 ms [User: 11.9 ms, System: 13.1 ms]
  Range (min … max): 15.4 ms … 16.7 ms 10 runs

$ hyperfine -w 10 -r 10 "changes/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello"
Benchmark 1: changes/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello
  Time (mean ± σ): 19.7 ms ± 0.3 ms [User: 11.3 ms, System: 17.4 ms]
  Range (min … max): 19.2 ms … 20.1 ms 10 runs

```

I.e., depending on actually committed heap size (`-Xms`), reduction of startup time by 20% or so in above cases.

Testing: tier1-5, gha

Thanks,
  Thomas
@tschatzl tschatzl force-pushed the submit/8071277-g1-merge-commits-uncommits branch from aaf4789 to 3024827 Compare September 19, 2025 07:39
@tschatzl tschatzl marked this pull request as ready for review September 19, 2025 09:31
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 19, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 19, 2025

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

1 participant