performance tests tune up

This commit is contained in:
mherbaghinyan 2019-01-02 22:18:53 +04:00
parent 5dd6d52025
commit 725076b8ee
1 changed files with 3 additions and 7 deletions

View File

@ -9,7 +9,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 10)
public class ArrayListBenchmark {
@ -63,6 +63,7 @@ public class ArrayListBenchmark {
public Employee testGet(ArrayListBenchmark.MyState state) {
return state.employeeList.get(state.employeeIndex);
}
@Benchmark
public Employee testVectorGet(ArrayListBenchmark.MyState state) {
return state.employeeVector.get(state.employeeIndex);
@ -78,14 +79,9 @@ public class ArrayListBenchmark {
state.employeeList.add(new Employee(state.iterations + 1, "John"));
}
@Benchmark
public void testAddVector(ArrayListBenchmark.MyState state) {
state.employeeVector.add(new Employee(state.iterations + 1, "John"));
}
public static void main(String[] args) throws Exception {
Options options = new OptionsBuilder()
.include(ArrayListBenchmark.class.getSimpleName()).threads(1)
.include(ArrayListBenchmark.class.getSimpleName()).threads(3)
.forks(1).shouldFailOnError(true)
.shouldDoGC(true)
.jvmArgs("-server").build();