AndPredicate#compare: Remove unnecessary calculation
Since the comparison method is called in a loop, all unnecessary
actions in this method will be called several times.
The expression "&& b instanceof DataSource" is redundant because
"b instanceof DataSource" is always true if
"cmp == 0 && a instanceof DataSource"
Release-Notes: skip
Change-Id: Id697c31e4854b6e9f68200195eaf642691825ff9
diff --git a/java/com/google/gerrit/index/query/AndPredicate.java b/java/com/google/gerrit/index/query/AndPredicate.java
index 23ae312..fda961d 100644
--- a/java/com/google/gerrit/index/query/AndPredicate.java
+++ b/java/com/google/gerrit/index/query/AndPredicate.java
@@ -134,7 +134,7 @@
cmp = a.estimateCost() - b.estimateCost();
}
- if (cmp == 0 && a instanceof DataSource && b instanceof DataSource) {
+ if (cmp == 0 && a instanceof DataSource) {
DataSource<?> as = (DataSource<?>) a;
DataSource<?> bs = (DataSource<?>) b;
cmp = as.getCardinality() - bs.getCardinality();