mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[eel][sdk] IJPL-214464 Streamline getAllSdks() to avoid extra allocations
Simplify the hot `getAllSdks()` path by dropping an intermediate `map { it.currentSnapshot }` stage and the trailing `toList()`. We now `flatMap` global workspace models directly to each model's `currentSnapshot` and `mapNotNull` its `SdkEntity` → `Sdk` mapping in one pass. This removes an unnecessary snapshots list and the final materialization while preserving ordering and results, reducing minor CPU and allocation overhead in frequent SDK lookups tied to IJPL‑214464.
(cherry picked from commit fa5f907f06f0fd8cca25550283061ec126c7c93d)
IJ-CR-180956
GitOrigin-RevId: fb02b0f6fc6eb46a59f33f1ab36e1439e745065e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1375f8c181
commit
21a271d2a1
+4
-5
@@ -50,11 +50,10 @@ class SdkTableBridgeImpl: SdkTableImplementationDelegate {
|
||||
|
||||
override fun getAllSdks(): List<Sdk> {
|
||||
val globalWorkspaceModels = GlobalWorkspaceModel.getInstancesBlocking()
|
||||
return globalWorkspaceModels.map {
|
||||
it.currentSnapshot
|
||||
}.flatMap { snapshot ->
|
||||
snapshot.entities(SdkEntity::class.java).mapNotNull { snapshot.sdkMap.getDataByEntity(it) }
|
||||
}.toList()
|
||||
return globalWorkspaceModels.flatMap {
|
||||
val snapshot = it.currentSnapshot
|
||||
snapshot.entities(SdkEntity::class.java).mapNotNull { sdkEntity -> snapshot.sdkMap.getDataByEntity(sdkEntity) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun createSdk(name: String, type: SdkTypeId, homePath: String?): Sdk {
|
||||
|
||||
Reference in New Issue
Block a user