K2: Optimize AbstractFirDeserializedSymbolProvider

Avoid filling caches with keys that are definitely empty
(if it's cheap to compute that), to decrease the size of backing maps.

The strategy is pre-computing the sets of names that might be met.
NB: the size of the sets is way fewer than a size of all queried names.
This commit is contained in:
Denis.Zharkov
2022-12-13 15:43:50 +01:00
committed by Space Team
parent e2e87bd107
commit 58c1b5dd1f
8 changed files with 96 additions and 11 deletions
@@ -18,6 +18,12 @@ interface PackagePartProvider {
*/
fun findPackageParts(packageFqName: String): List<String>
/**
* This method is only for sake of optimization
* @return package names set for which that provider has package parts
*/
fun computePackageSetWithNonClassDeclarations(): Set<String>
fun getAnnotationsOnBinaryModule(moduleName: String): List<ClassId>
fun getAllOptionalAnnotationClasses(): List<ClassData>
@@ -28,5 +34,7 @@ interface PackagePartProvider {
override fun getAnnotationsOnBinaryModule(moduleName: String): List<ClassId> = emptyList()
override fun getAllOptionalAnnotationClasses(): List<ClassData> = emptyList()
override fun computePackageSetWithNonClassDeclarations(): Set<String> = emptySet()
}
}