RFR: 8325403: Add SystemGC JMH benchmarks

Stefan Johansson sjohanss at openjdk.org
Fri Feb 9 10:06:51 UTC 2024


Please review this change to add some System GC JMH benchmarks.

**Summary**
When developing and improving the Full GC implementation for the different GCs, using `System.gc()` to test performance is sometime very useful. This change adds a set of System GC benchmarks using JMH. The tests all have the same structure, a `@Setup` function that generates heap contents and a `@Benchmark` function which only calls `System.gc()`. The different scenarios covers some basic use-cases but more can certainly be added going forward. 

Since the benchmark function is just a single call to trigger the GC it makes sense to use the single shot JMH mode and fork a new JVM for each run. The tests also specify default heap options to avoid triggering GC during object creation to give all runs more or less the same heap layout.

**Testing**
Local and aurora testing verifying that results are fairly stable.

-------------

Commit messages:
 - Some comments
 - Setting default heap options for the test
 - Added benchmark that forces some GCs to preerve marks
 - One more EOF newline
 - Newlines at EOF
 - Better defaults for ootb runs and some cleanups
 - SystemGC benchmarks refresh

Changes: https://git.openjdk.org/jdk/pull/17784/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17784&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8325403
  Stats: 885 lines in 13 files changed: 885 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/17784.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17784/head:pull/17784

PR: https://git.openjdk.org/jdk/pull/17784


More information about the hotspot-gc-dev mailing list