performance tests tune up
This commit is contained in:
parent
5dd6d52025
commit
725076b8ee
@ -9,7 +9,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@BenchmarkMode(Mode.AverageTime)
|
@BenchmarkMode(Mode.AverageTime)
|
||||||
@OutputTimeUnit(TimeUnit.MICROSECONDS)
|
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
||||||
@Warmup(iterations = 10)
|
@Warmup(iterations = 10)
|
||||||
public class ArrayListBenchmark {
|
public class ArrayListBenchmark {
|
||||||
|
|
||||||
@ -63,6 +63,7 @@ public class ArrayListBenchmark {
|
|||||||
public Employee testGet(ArrayListBenchmark.MyState state) {
|
public Employee testGet(ArrayListBenchmark.MyState state) {
|
||||||
return state.employeeList.get(state.employeeIndex);
|
return state.employeeList.get(state.employeeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public Employee testVectorGet(ArrayListBenchmark.MyState state) {
|
public Employee testVectorGet(ArrayListBenchmark.MyState state) {
|
||||||
return state.employeeVector.get(state.employeeIndex);
|
return state.employeeVector.get(state.employeeIndex);
|
||||||
@ -78,14 +79,9 @@ public class ArrayListBenchmark {
|
|||||||
state.employeeList.add(new Employee(state.iterations + 1, "John"));
|
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 {
|
public static void main(String[] args) throws Exception {
|
||||||
Options options = new OptionsBuilder()
|
Options options = new OptionsBuilder()
|
||||||
.include(ArrayListBenchmark.class.getSimpleName()).threads(1)
|
.include(ArrayListBenchmark.class.getSimpleName()).threads(3)
|
||||||
.forks(1).shouldFailOnError(true)
|
.forks(1).shouldFailOnError(true)
|
||||||
.shouldDoGC(true)
|
.shouldDoGC(true)
|
||||||
.jvmArgs("-server").build();
|
.jvmArgs("-server").build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user