Update CollectionsBenchmark.java
This commit is contained in:
parent
224dce952b
commit
8bcc305853
|
@ -11,6 +11,9 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@BenchmarkMode(Mode.AverageTime)
|
||||||
|
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
||||||
|
@Warmup(iterations = 5)
|
||||||
public class CollectionsBenchmark {
|
public class CollectionsBenchmark {
|
||||||
|
|
||||||
@State(Scope.Thread)
|
@State(Scope.Thread)
|
||||||
|
@ -35,19 +38,12 @@ public class CollectionsBenchmark {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
@BenchmarkMode(Mode.AverageTime)
|
|
||||||
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
|
||||||
@Warmup(iterations = 1)
|
|
||||||
public boolean testArrayList(MyState state) {
|
public boolean testArrayList(MyState state) {
|
||||||
return state.employeeList.contains(state.employee);
|
return state.employeeList.contains(state.employee);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
@BenchmarkMode(Mode.AverageTime)
|
|
||||||
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
|
||||||
@Warmup(iterations = 1)
|
|
||||||
public boolean testHashSet(MyState state) {
|
public boolean testHashSet(MyState state) {
|
||||||
return state.employeeSet.contains(state.employee);
|
return state.employeeSet.contains(state.employee);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue