RFR: 8325403: Add SystemGC JMH benchmarks

Stefan Johansson sjohanss at openjdk.org
Mon Feb 12 13:28:02 UTC 2024


On Fri, 9 Feb 2024 11:53:17 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> 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.
>
> Since all of them are related to system-gc, does it make sense to put them inside a folder, `system_gc`, and a text file containing info on how to run them altogether?

@albertnetymk, I did the re-structure and some additional renaming and I think it got better so pushed the change. 

It is possible to use dir-names for the test regexp and using `system_gc` looks nicer compared to `SystemGC` so all happy with that. As you can see I also removed `SystemGC` from all class names and renamed the benchmarking method to `gc()`. I think that gives a somewhat nicer summary since the benchmark method is always included: 

Benchmark                       Mode  Cnt    Score    Error  Units
AllDead.gc                        ss    5   27.497 ?  8.243  ms/op
AllLive.gc                        ss    5   61.810 ? 12.743  ms/op
DifferentObjectSizesArray.gc      ss    5  100.789 ? 15.057  ms/op
DifferentObjectSizesHashMap.gc    ss    5  106.284 ?  8.125  ms/op
DifferentObjectSizesTreeMap.gc    ss    5  106.660 ? 33.727  ms/op
HalfDeadFirstPart.gc              ss    5   45.340 ?  7.520  ms/op
HalfDeadInterleaved.gc            ss    5   98.831 ? 10.364  ms/op
HalfDeadInterleavedChunks.gc      ss    5   81.978 ? 10.992  ms/op
HalfDeadSecondPart.gc             ss    5   43.968 ?  8.859  ms/op
HalfHashedHalfDead.gc             ss    5  105.144 ? 13.341  ms/op
NoObjects.gc                      ss    5   17.498 ?  2.751  ms/op
OneBigObject.gc                   ss    5  114.798 ? 19.266  ms/op

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

PR Comment: https://git.openjdk.org/jdk/pull/17784#issuecomment-1938676851


More information about the hotspot-gc-dev mailing list