[LC] optimize String allocations in org.jetbrains.kotlin.asJava.LightClassUtil.isMangled
^KT-63486 fixed
This commit is contained in:
committed by
Space Team
parent
6edc742934
commit
364dcd30c8
@@ -71,7 +71,10 @@ object LightClassUtil {
|
|||||||
|
|
||||||
private fun isMangled(wrapperName: @NlsSafe String, prefix: String): Boolean {
|
private fun isMangled(wrapperName: @NlsSafe String, prefix: String): Boolean {
|
||||||
//see KT-54803 for other mangling strategies
|
//see KT-54803 for other mangling strategies
|
||||||
return wrapperName.startsWith("$prefix$")
|
// A memory optimization for `wrapperName.startsWith("$prefix$")`, see KT-63486
|
||||||
|
return wrapperName.length > prefix.length
|
||||||
|
&& wrapperName[prefix.length] == '$'
|
||||||
|
&& wrapperName.startsWith(prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLightFieldForCompanionObject(companionObject: KtClassOrObject): PsiField? {
|
fun getLightFieldForCompanionObject(companionObject: KtClassOrObject): PsiField? {
|
||||||
|
|||||||
Reference in New Issue
Block a user