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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user