Liya Fan created ARROW-7506:
-------------------------------
Summary: [Java] JMH benchmarks should be called from main methods
Key: ARROW-7506
URL: https://issues.apache.org/jira/browse/ARROW-7506
Project: Apache Arrow
Issue Type: Bug
Components: Java
Reporter: Liya Fan
Assignee: Liya Fan
Some benchmarks are called as unit tests in our current code base. They should
be called from main methods, because:
1. This is the recommended way of writing JMH benchmarks. The automatically
generated benchmarks are called from main, and sample benchmarks provided by
JMH [1] are also called from main.
2. Some compiler does not support calling JMH as unit test. For example, the
"javac with error prone" reports the following error:
Error:(100, 15) java: [JUnit4TearDownNotRun] tearDown() method will not be run;
please add JUnit's @After annotation
(see https://errorprone.info/bugpattern/JUnit4TearDownNotRun)
Did you mean '@After'?
3. When run as a unit test, enable assert flag will be turned on by default, so
some test/debug operations will be performed. This will distort the benchmark
result data. For example, a related discussion can be found in [2].
[1]
https://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/
[2] https://github.com/apache/arrow/pull/5842#issuecomment-558082914
--
This message was sent by Atlassian Jira
(v8.3.4#803005)