JMH Question: execution of code when iteration completes before TearDown

Lev Serebryakov lev at serebryakov.spb.ru
Tue Sep 27 12:57:39 UTC 2016


On 27.09.2016 15:54, Aleksey Shipilev wrote:

> How's that different from making an additional @State(Thread) object,
> and store the thread-local data there? Its @Setup/@TearDown methods
> would be touched by the worker thread only:
>  http://hg.openjdk.java.net/code-tools/jmh/file/e810ce09937a/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_03_States.java
 Storing thread-local data in separate object will give different false
sharing/no-false sharing picture, but such state object could initialize
my implementation, indeed!

> It can even initialize after the shared @State(Benchmark) object:
> http://hg.openjdk.java.net/code-tools/jmh/file/e810ce09937a/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_29_StatesDAG.java
 Thanks! I'll try this!

-- 
// Black Lion AKA Lev Serebryakov



More information about the jmh-dev mailing list