-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
目前在 JHM 结果 https://github.com/meowool-catnip/cloak/runs/5175083247?check_suite_focus=true#step:4:537 中表明 constructor 的缓存要比直接获取要慢,因此可能是不必要的空运算导致的
cloak/api/src/jvmMain/kotlin/com/meowool/cloak/internal/ReflectionFactory.kt
Lines 182 to 205 in 73a1c60
override fun equals(other: Any?): Boolean { | |
if (this === other) return true | |
if (other !is MemberCacheKey) return false | |
if (kind != other.kind) return false | |
if (clasѕ != other.clasѕ) return false | |
if (name != other.name) return false | |
if (parameters != null) { | |
if (other.parameters == null) return false | |
if (!parameters.contentEquals(other.parameters)) return false | |
} else if (other.parameters != null) return false | |
if (returns != other.returns) return false | |
return true | |
} | |
override fun hashCode(): Int { | |
var result = kind.hashCode() | |
result = 31 * result + clasѕ.hashCode() | |
result = 31 * result + (name?.hashCode() ?: 0) | |
result = 31 * result + (parameters?.contentHashCode() ?: 0) | |
result = 31 * result + (returns?.hashCode() ?: 0) | |
return result | |
} |
考虑将缓存键对象拆分为不同的类 [FieldCacheKey
, ConstructorCacheKey
, MethodCacheKey
]
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request