Created
August 30, 2012 06:18
-
-
Save benelog/3523197 to your computer and use it in GitHub Desktop.
Junit Benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.8</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.httpcomponents</groupId> | |
<artifactId>httpclient</artifactId> | |
<version>4.1.3</version> | |
</dependency> | |
<dependency> | |
<groupId>com.carrotsearch</groupId> | |
<artifactId>junit-benchmarks</artifactId> | |
<version>0.3.0</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.h2database</groupId> | |
<artifactId>h2</artifactId> | |
<version>1.3.166</version> | |
<scope>test</scope> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Test; | |
import com.carrotsearch.junitbenchmarks.AbstractBenchmark; | |
import com.carrotsearch.junitbenchmarks.BenchmarkOptions; | |
import com.carrotsearch.junitbenchmarks.annotation.BenchmarkMethodChart; | |
/** | |
* @author benelog | |
*/ | |
@BenchmarkMethodChart(filePrefix = "benchmark-sample") | |
public class SampleBenchmarkTest extends AbstractBenchmark { | |
@Test | |
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 0) | |
public void test1() { | |
System.out.println("hello world1"); | |
} | |
@Test | |
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 0) | |
public void test2() { | |
System.out.println("hello world2"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment