Vector class more tests

This commit is contained in:
mherbaghinyan 2018-12-27 12:48:51 +04:00
parent 64b205a6ce
commit 5dd6d52025
1 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,11 @@ public class ArrayListBenchmark {
return state.employeeList.contains(state.employee); return state.employeeList.contains(state.employee);
} }
@Benchmark
public boolean testContainsVector(ArrayListBenchmark.MyState state) {
return state.employeeVector.contains(state.employee);
}
@Benchmark @Benchmark
public int testIndexOf(ArrayListBenchmark.MyState state) { public int testIndexOf(ArrayListBenchmark.MyState state) {
return state.employeeList.indexOf(state.employee); return state.employeeList.indexOf(state.employee);
@ -73,6 +78,11 @@ 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(1)