Skip to content

Commit 400bddd

Browse files
[Performance] Full build takes more time since 2024-09 (type inference) (#3384)
optimize 1: + record only pairs where both types are parameterized optimize 2: + stop traversal when both types are the same Fixes #3327
1 parent c002247 commit 400bddd

File tree

1 file changed

+5
-2
lines changed
  • org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup

1 file changed

+5
-2
lines changed

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,11 +1267,14 @@ protected List<Pair<TypeBinding>> allSuperPairsWithCommonGenericType(TypeBinding
12671267
if (s == null || s.id == TypeIds.T_JavaLangObject || t == null || t.id == TypeIds.T_JavaLangObject)
12681268
return Collections.emptyList();
12691269
List<Pair<TypeBinding>> result = new ArrayList<>();
1270-
if (TypeBinding.equalsEquals(s.original(), t.original())) {
1270+
if (s.isParameterizedType() && t.isParameterizedType() // optimization #1: clients of this method only want to compare type arguments
1271+
&& TypeBinding.equalsEquals(s.original(), t.original())) {
12711272
result.add(new Pair<>(s, t));
12721273
}
1274+
if (TypeBinding.equalsEquals(s, t))
1275+
return result; // optimization #2: nothing interesting above equal types
12731276
TypeBinding tSuper = t.findSuperTypeOriginatingFrom(s);
1274-
if (tSuper != null) {
1277+
if (tSuper != null && s.isParameterizedType() && tSuper.isParameterizedType()) { // optimization #1 again
12751278
result.add(new Pair<>(s, tSuper));
12761279
}
12771280
result.addAll(allSuperPairsWithCommonGenericType(s.superclass(), t));

0 commit comments

Comments
 (0)