Update CollectionsBenchmark.java

This commit is contained in:
Mher Baghinyan 2018-08-13 17:12:48 +04:00 committed by GitHub
parent 224dce952b
commit 8bcc305853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -11,6 +11,9 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 5)
public class CollectionsBenchmark {
@State(Scope.Thread)
@ -35,19 +38,12 @@ public class CollectionsBenchmark {
}
}
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 1)
public boolean testArrayList(MyState state) {
return state.employeeList.contains(state.employee);
}
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 1)
public boolean testHashSet(MyState state) {
return state.employeeSet.contains(state.employee);
}