The recently accepted OOPSLA paper, Advancing Performance via a Systematic Application of Research and Industrial Best Practice, suggested that there is a large performance regression using G1 between JDK 11 and 21.
The attached plots used the following configuration:
JVM args: -server -XX:+AlwaysPreTouch -Xms${heap}m -Xmx${heap}m -Xlog:gc*:file=lusearch.jdk${JDK}.${heap}.${i}.gc::filesize=0
And invoking DaCapo with: -jar dacapo-23.11-chopin.jar lusearch -s default -n 25
Thomas has done further investigations and it does seem to be an issue with Panama/FFI/MemorySegment performance. The performance issue is not isolated to G1 as also Parallel can be observed having this issue depending on the -Dorg.apache.lucene.store.MMapDirectory.enableMemorySegment setting.
The problem is that from JDK 19 to JDK 21 lucene selects a code path that uses the MemorySegment API (It does not when running with JDK22+ for unknown reasons, so performance is back to previous levels).
Not sure if this is a problem with the MemorySegment API or the Lucene use of the API. At least I would not expect that large of a performance difference.
The affects version is set based on the lucene versions showing this performance difference.