whbing commented on PR #6974:
URL: https://github.com/apache/ozone/pull/6974#issuecomment-2301472548
> Is it ready for review?
@siddhantsangwan Thanks! it's ready.
> Let me know if you see any problems with this.
No problem! The giving method is more concise and efficient.
```java
@Benchmark
@Threads(500)
public boolean testIndexCompare() {
List<Integer> indexes = replicaIndexes.stream()
.sorted()
.distinct()
.collect(Collectors.toList());
return !(indexes.size() >= D && indexes.get(D - 1) == D);
}
@Benchmark
@Threads(500)
public boolean testLoop() {
for (int i = 1; i <= D; i++) {
if (replicaIndexes.contains(i)) {
return true;
}
}
return false;
}
Benchmark Mode Cnt Score Error Units
ECDataIndexesBenchmark1.testIndexCompare avgt 4 0.035 ± 0.035 ms/op
ECDataIndexesBenchmark1.testLoop avgt 4 0.001 ± 0.001 ms/op
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]