Jac*_* G. 5 java benchmarking microbenchmark jmh java-12
根据JEP 230:Microbenchmark Suite,存在Java 12内置的微基准套件。JEP解释说它基本上是JMH,但无需使用Maven / Gradle明确依赖它。但是,它没有指定如何访问属于该套件的类/注释来执行基准测试。
我的问题是:
module-info.java要使用此套件,我是否需要一个特定的Java模块?Your interpretation is incorrect. The JEP says:
Add a basic suite of microbenchmarks to the JDK source code, and make it easy for developers to run existing microbenchmarks and create new ones.
i.e. this is not necessarily something that makes it into a JDK distribution, just something that is added to the source code repository to make it easier to run benchmarks on JDK code. Though, to be fair, the fact that it's listed as one of the JDK 12 'features' seems a tad misleading.
The benchmarks can be run by using the OpenJDK build system. Once you have cloned the OpenJDK source code from http://hg.openjdk.java.net/jdk/jdk/ (or another repository that includes the JEP), you can run benchmarks e.g. by using:
make test TEST="micro:java.lang.reflect"
Run Code Online (Sandbox Code Playgroud)
基准位于\test\micro\目录中。另请参见文档:http : //hg.openjdk.java.net/jdk/jdk/raw-file/ddfb658c8ce3/doc/testing.html#microbenchmarks
另外,这要求您在生成构建配置时指定JMH及其依赖项:
bash configure --with-jmh="/path/to/jmh/jars"
Run Code Online (Sandbox Code Playgroud)
所需的jar是:commons-math3,jmh-core,jmh-generator-annprocess和jopt-simple。
| 归档时间: |
|
| 查看次数: |
584 次 |
| 最近记录: |