Optimize away unneeded FqName computation in KotlinBuiltIns

Before computing the FqName, check the simple class name first. This
code was responsible for about 20% of FqNameUnsafe instances created
during compilation of "core" modules
This commit is contained in:
Alexander Udalov
2017-06-21 15:33:12 +03:00
parent 0352bdbca5
commit 59b932a815
6 changed files with 42 additions and 42 deletions
@@ -119,9 +119,6 @@ object CollectionLiteralResolver {
val descriptor = expectedType.constructor.declarationDescriptor ?: return ARRAY_OF_FUNCTION
val arrayFqName = DescriptorUtils.getFqName(descriptor)
val primitiveType = KotlinBuiltIns.getPrimitiveTypeByArrayClassFqName(arrayFqName)
return PRIMITIVE_TYPE_TO_ARRAY[primitiveType] ?: ARRAY_OF_FUNCTION
return PRIMITIVE_TYPE_TO_ARRAY[KotlinBuiltIns.getPrimitiveArrayType(descriptor)] ?: ARRAY_OF_FUNCTION
}
}
}