Control the order of methods using JMH

瘦欲@ 提交于 2021-01-26 13:51:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!