JMH v0.6
Aleksey Shipilev
aleksey.shipilev at oracle.com
Fri Apr 25 07:11:24 UTC 2014
Hi there,
We have promoted JMH 0.6. A brief glimpse of what's changed:
* @Setup/@TearDown methods now accept BlackHole/Control as parameters.
This was a feature request from two external users, and we would like
to hear if there are any quirks. We added the relevant sample [1].
* Since some users were burned on this, "new BlackHole()" is forbidden
now, and will throw an exception at runtime [2]. Use injected Blackholes
instead.
* JVM languages archetypes are now generating projects which are usable
as Maven subprojects. Before that, we had a quirk [3] with relative
build paths.
* BenchmarkMode.SampleTime now backs off more rapidly with the very
thin benchmarks, each thread can do a sample at least every 50us [4].
This helps to alleviate the nanotime latency and scalability overheads
for nano/microbenchmarks. As usual, if the test is larger than that, we
capture all the samples.
* A few more compile-time checks for benchmarks are done now, to
future-proof the upcoming harness updates. Notably, static methods are
no more acceptable by @GMB.
* JMH generates the distinct compilation units for each @GMB method
(or the @Group of @GMB methods) now. This helps to make the generated
code more robust and isolated. This should be transparent to the users,
but those who review the generated code a lot might enjoy smaller-sized
compilation units.
* EXPERIMENTAL: @State objects can be referenced in @Setup/@TearDown
parameters as well. This feature is experimental, and not recommended
for general use. But, if you know the examples where this feature is
fitting, please try to play with it and find bugs there :) There is also
the relevant sample [5].
Enjoy!
Thanks,
-Aleksey.
[1]
http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_28_BlackholeHelpers.java
[2] http://hg.openjdk.java.net/code-tools/jmh/rev/de0365d7e4d0
[3] http://hg.openjdk.java.net/code-tools/jmh/rev/292b20d8fa97, etc
[4] http://hg.openjdk.java.net/code-tools/jmh/rev/cde312963a3d
[5]
http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_29_StatesDAG.java
More information about the jmh-dev
mailing list