From 9579bc6a0cccd2b307f158195919a2257d106319 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 19 Jan 2025 20:56:32 +0700 Subject: [PATCH] LinkedHashSet instead of ObjectLinkedOpenHashSet for update performance because LinkedHashSet uses linked list, while ObjectLinkedOpenHashSet use sequential array of keys --- .../mc/otm/block/entity/cable/EnergyCableGraph.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt index 13e60b2b5..85764bd1e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt @@ -1,8 +1,5 @@ package ru.dbotthepony.mc.otm.block.entity.cable -import it.unimi.dsi.fastutil.ints.IntLists -import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap import it.unimi.dsi.fastutil.objects.ReferenceArraySet import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet @@ -19,6 +16,7 @@ import ru.dbotthepony.mc.otm.onceServer import java.util.* import kotlin.collections.ArrayList import kotlin.collections.HashSet +import kotlin.collections.LinkedHashSet import kotlin.math.ln class EnergyCableGraph : GraphNodeList() { @@ -69,7 +67,7 @@ class EnergyCableGraph : GraphNodeList() + val segments = LinkedHashSet() private var shortCircuit = false private var lastTickTransfers = 0 private var lastTick = 0 @@ -134,7 +132,7 @@ class EnergyCableGraph : GraphNodeList() + private val nodes = LinkedHashSet() private val paths = ReferenceOpenHashSet() operator fun contains(node: EnergyCableBlockEntity.Node): Boolean {