JVM KT-48944 improve performance of FunctionReference#equals

'getOwner()' computes KDeclarationContainer for function references,
which can be costly. Compare other FunctionReference properties first.
This commit is contained in:
Dmitry Petrov
2021-11-18 16:47:03 +03:00
parent aa0c2ddea5
commit 77dde26c7c
@@ -105,12 +105,12 @@ public class FunctionReference extends CallableReference implements FunctionBase
if (obj instanceof FunctionReference) {
FunctionReference other = (FunctionReference) obj;
return Intrinsics.areEqual(getOwner(), other.getOwner()) &&
getName().equals(other.getName()) &&
return getName().equals(other.getName()) &&
getSignature().equals(other.getSignature()) &&
flags == other.flags &&
arity == other.arity &&
Intrinsics.areEqual(getBoundReceiver(), other.getBoundReceiver());
Intrinsics.areEqual(getBoundReceiver(), other.getBoundReceiver()) &&
Intrinsics.areEqual(getOwner(), other.getOwner());
}
if (obj instanceof KFunction) {
return obj.equals(compute());