mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
optimization: do not allocate primitive Long wrappers unnecessarily (part of KTIJ-27475 Investigate Kotlin plugin excessive memory usage)
GitOrigin-RevId: 34c2eb0d117de642da4adaeda61985287448c8de
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d109fc8433
commit
84d0c3fe17
@@ -29,6 +29,7 @@ import com.intellij.util.ExceptionUtil
|
||||
import com.intellij.util.ObjectUtils
|
||||
import com.intellij.util.concurrency.AppExecutorUtil
|
||||
import com.intellij.util.containers.CollectionFactory
|
||||
import com.intellij.util.containers.ConcurrentLongObjectHashMap
|
||||
import io.opentelemetry.api.metrics.Meter
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
@@ -73,7 +74,7 @@ internal open class EntityStorageSnapshotImpl(
|
||||
|
||||
// I suppose that we can use some kind of array of arrays to get a quicker access (just two accesses by-index)
|
||||
// However, it's not implemented currently because I'm not sure about threading.
|
||||
private val entitiesCache = ConcurrentHashMap<EntityId, WorkspaceEntity>()
|
||||
private val entitiesCache = ConcurrentLongObjectHashMap<WorkspaceEntity>()
|
||||
|
||||
override fun <T> cached(query: StorageQuery<T>): T {
|
||||
return snapshotCache.cached(query)
|
||||
@@ -94,7 +95,7 @@ internal open class EntityStorageSnapshotImpl(
|
||||
return found as T
|
||||
}
|
||||
val newData = newInstance()
|
||||
entitiesCache[entityId] = newData
|
||||
entitiesCache.put(entityId, newData)
|
||||
return newData
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user