Currently using trying to use JMH 1.33 with JDK 17. However, invoking JMH programatically seems to use sun.mis.Unsafe. Since 1.33 is the latest version of JMH, it therefore seems like it is impossible to use JMH with JDK 17? I hope this is not the case since I'm trying to benchmark some of the newer APIs so using an older version of the JDK is not an option for me.
I'm using the following wrapper code:
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(QuadPointBenchmark.class.getName())
.warmupTime(TimeValue.seconds(10))
.detectJvmArgs()
.mode(Mode.AverageTime)
.timeUnit(TimeUnit.NANOSECONDS)
.build();
new Runner(opt).run();
}
And here are the relevant portions of my pom file:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jmh.version>1.33</jmh.version>
<javac.target>17</javac.target>
<uberjar.name>benchmarks</uberjar.name>
</properties>
<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
</dependencies>