JMH 1.5

Aleksey Shipilev aleksey.shipilev at
Thu Jan 22 20:27:37 UTC 2015


JMH 1.5 is released and available at Maven Central (thanks to Evgeny,
as usual). This is a release geared towards some intrusive internal
changes, and also a few externally visible ones. Therefore, we have
bumped the minor version. We are pretty confident it is stable, given
our good test coverage, but please try 1.5 in your scenarios, and report
the bugs, if any.

Summary of changes:

 * As per recommendation of OpenJDK Wiki, perfasm profiler now also
collects and parses interpreter and VM stub code. This is very helpful
when you are dealing with benchmarks that call into VM stubs a lot. (Try
e.g. new String(char[]) that calls into generated arraycopy stub).
Tracked as:

 * Seeing how users mangle the final text report to fit it in narrow
editors (e.g. 80-char-wide mail, bug reports, etc.), we have trimmed up
the final text report. Tracked as:

  Example output on 1.4.2:

    Benchmark                     Mode  Samples  Score   Error  Units
    o.o.MyBenchmark.testMethod    avgt        5  0.252 ± 0.003  ns/op

  Example output on 1.5:

    Benchmark               Mode  Cnt  Score   Error  Units
    MyBenchmark.testMethod  avgt    5  0.253 ± 0.006  ns/op

 * JMH is now buildable with JDK 9.

Also, we are trying to approach a few complicated issues in the
benchmark code generation, and therefore a few related issues were fixed

 * Benchmark generators would emit the duplicate @Setup/@TearDown
handling code blocks. While the internal mechanics of tracking the
helper state prevented bugs, it still bloated the generated code:

 * @Setup/@TearDown for @State(Scope.Thread) were doing the useless
status flag checks. It bloats the code, hides issues like
CODETOOLS-7901265 and CODETOOLS-7901266, and might negatively affect the
performance of nano-benchmarks. Fixed:

 * @Setup/@TearDown for @State(Scope.Benchmark/Group) were using
overly-synchronized handling for initialization, that blocks every
thread trying to init the state object. We can do proper DCL there,
alleviating the sync costs:

 * More tests for benchmark generators, etc.



More information about the jmh-dev mailing list