JMH java benchmark

 

maven dependence

    <dependencies>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>${jmh.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-annprocess</artifactId>
            <version>${jmh.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jmh.version>1.0</jmh.version>
        <javac.target>1.6</javac.target>
        <uberjar.name>benchmarks</uberjar.name>
    </properties>

 

Command line:

  Generating a test project

mvn archetype:generate \
          -DinteractiveMode=false \
          -DarchetypeGroupId=org.openjdk.jmh \
          -DarchetypeArtifactId=jmh-java-benchmark-archetype \
          -DgroupId=org.sample \
          -DartifactId=test \
          -Dversion=1.0

  Bale

$ cd test/
$ mvn clean install

  carried out, 

java -jar target/benchmarks.jar
java -jar target / benchmarks.jar -h // view help

 

Plug-ins 

   Plug idea

  Plug-in will affect the implementation of the results, but will not exceed a maximum of 2.2%

A brief research shows that benchmark results are affected, but not that much. The whole research is described in Research results. 
Long story short, the maximum means difference observed was 2.2%.

  

 

 

 

 

Participate in the link:

http://openjdk.java.net/projects/code-tools/jmh/

Guess you like

Origin www.cnblogs.com/siqi/p/12038557.html