From d8f253d07b22b17edb9b531ff1b1dcc68957297d Mon Sep 17 00:00:00 2001 From: Marco Pennekamp Date: Tue, 11 Apr 2023 13:20:02 +0200 Subject: [PATCH] [LL FIR] KT-57207 Choose combined Java symbol providers cache size --- .../api/fir/providers/LLFirCombinedJavaSymbolProvider.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/providers/LLFirCombinedJavaSymbolProvider.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/providers/LLFirCombinedJavaSymbolProvider.kt index a43d33e2840..6c8fe0c84d3 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/providers/LLFirCombinedJavaSymbolProvider.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/providers/LLFirCombinedJavaSymbolProvider.kt @@ -40,6 +40,10 @@ internal class LLFirCombinedJavaSymbolProvider private constructor( /** * The purpose of this cache is to avoid index access for frequently accessed `ClassId`s, including failures. Because Java symbol * providers currently cannot benefit from a "name in package" check (see KTIJ-24642), the cache should also store negative results. + * + * The cache size has been chosen with the help of local benchmarks and performance tests. A cache size of 2500 in comparison to 1000 + * resulted in less time spent in [computeClassLikeSymbolByClassId] in local benchmarks. Cache sizes of 5000 and 10000 were tried in + * performance tests, but didn't affect performance. A cache size of 2500 is a good middle ground with a small memory footprint. */ private val classCache: NullableCaffeineCache = NullableCaffeineCache { it.maximumSize(2500) }