问题
I'm using JMH benchmark in my project. I have method 1 and method 2 annotated with @Benchmark. I want the order to be: method1, method2, mehod1, method2... and so on... Which means: I wand that method 2 will immediately follow method 1. Is there a way to do so?
Thank you!
回答1:
The order in which JMH executes @Benchmark
methods is usually irrelevant: the runs are isolated from each other, and so results are independent. But in case you still want the particular order, then @Benchmark
-s are executed in the lexicographical order, hence, rename your methods in that order.
来源:https://stackoverflow.com/questions/36261369/control-the-order-of-methods-using-jmh