Use jmh (Java microbenchmark harness) in Java for performance test

The full name of jmh is java microbenchmark harness, which is a suite used for performance testing in open JDK. The suite has been included in JDK 12.

This article will explain how to use jmh to do performance testing in Java.

If you are not using JDK 12, you need to add the following dependencies:

<dependency>
    <groupId>org.openjdk.jmh</groupId>
    <artifactId>jmh-core</artifactId>
    <version>1.19</version>
</dependency>
<dependency>
    <groupId>org.openjdk.jmh</groupId>
    <artifactId>jmh-generator-annprocess</artifactId>
    <version>1.19</version>
</dependency>

Performance test with jmh

BenchmarkMode

Fork and warmup

State and scope

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>