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) {
|
if (obj instanceof FunctionReference) {
|
||||||
FunctionReference other = (FunctionReference) obj;
|
FunctionReference other = (FunctionReference) obj;
|
||||||
|
|
||||||
return Intrinsics.areEqual(getOwner(), other.getOwner()) &&
|
return getName().equals(other.getName()) &&
|
||||||
getName().equals(other.getName()) &&
|
|
||||||
getSignature().equals(other.getSignature()) &&
|
getSignature().equals(other.getSignature()) &&
|
||||||
flags == other.flags &&
|
flags == other.flags &&
|
||||||
arity == other.arity &&
|
arity == other.arity &&
|
||||||
Intrinsics.areEqual(getBoundReceiver(), other.getBoundReceiver());
|
Intrinsics.areEqual(getBoundReceiver(), other.getBoundReceiver()) &&
|
||||||
|
Intrinsics.areEqual(getOwner(), other.getOwner());
|
||||||
}
|
}
|
||||||
if (obj instanceof KFunction) {
|
if (obj instanceof KFunction) {
|
||||||
return obj.equals(compute());
|
return obj.equals(compute());
|
||||||
|
|||||||
Reference in New Issue
Block a user