RFR: 8061282: Migrate jmh-jdk-microbenchmarks into the JDK

Mandy Chung mandy.chung at oracle.com
Thu Nov 15 22:50:07 UTC 2018

Hi Claes,

It's good to see this JEP targeted and integrate the microbenchmarks to 
colocate with JDK.  Overall the work looks good.

The copyright headers need update to GPL.  There are some super long 
lines (mostly looking up method handles), for example:

+        MethodHandle bodyNormal = MethodHandles.lookup().findStatic(MethodHandlesCatchException.class, "doWorkNormal", MethodType.methodType(void.class, MethodHandlesCatchException.class));
+        MethodHandle bodyExceptional = MethodHandles.lookup().findStatic(MethodHandlesCatchException.class, "doWorkExceptional", MethodType.methodType(void.class, MethodHandlesCatchException.class));
+        MethodHandle fallback = MethodHandles.lookup().findStatic(MethodHandlesCatchException.class, "fallback", MethodType.methodType(void.class, MyException.class, MethodHandlesCatchException.class));

JEP 230 proposes to separate the resources from the source files in 
micro/classes and micro/resources directories.  What kinds of resources 
are expected to be placed under micro/resources directory?  If they are 
java resources, then I would expect them follow the consistent layout as 
JDK source tree where the java classes and resources are placed together.

I was trying to experiment building and running the benchmarks. What 
does configure --with-jmh expect to contain?  I can't quite figure it 
out from the error message.

The JEP describes make build-microbenchmark and run-test targets to 
build and execute the microbenchmarks.

It'd also be helpful to update the JEP to include an example how to run 
a specific set of benchmarks e.g. 
org.openjdk.bench.java.lang.ObjectHashCode and how to run the benchmarks 
with JDK n and JDK n-1 and compare the result (is there a build target 
to do this)?   We can reference this JEP to get started running the 
microbenchmark and refer to JMH and other documentation for other 
details like developing a JMH benchmark.


On 10/18/18 2:03 PM, Claes Redestad wrote:
> Hi,
> as the final part of JEP 230: Microbenchmarks Suite, I propose 
> migrating all microbenchmarks from the codetools 
> jmh-jdk-microbenchmarks project into the JDK:
> http://cr.openjdk.java.net/~redestad/8061282/jdk.00/
> This is built on top of the patch for JDK-8061281, and makes the 
> entirety of this suite readily available to build, run and experiment 
> with from the main jdk repos.
> While the future of the codetools jmh-jdk-microbenchmarks project is 
> out of scope for JEP 230, it has been suggested it could be kept alive 
> as a stabilization target and that stable microbenchmarks should be 
> kept out of the jdk. That discussion is partly out of scope here, but 
> I believe it makes sense to keep a copy in the JDK suite precisely 
> because the benchmark will be compiled with the platform javac, 
> meaning a different set of bugs, regressions and improvements will be 
> discoverable.
> Two micros, org.openjdk.bench.java.lang.invoke.Indify and 
> org.opendjk.bench.java.lang.reflect.GetAnnotation need special build 
> treatment and will need to be dealt with in a follow-up.
> Thanks!
> /Claes

More information about the jdk-dev mailing list