From 953ebf49e829c898d5990f9a4127f7d3144a05d9 Mon Sep 17 00:00:00 2001 From: AoElite <20812471+AoElite@users.noreply.github.com> Date: Thu, 28 Dec 2023 17:44:39 -0500 Subject: [PATCH] performance tweak --- src/main/java/ac/grim/grimac/player/GrimPlayer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index bb2c015b7d..adeb278df7 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -49,6 +49,7 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicInteger; @@ -67,7 +68,7 @@ public class GrimPlayer implements GrimUser { // Determining player ping // The difference between keepalive and transactions is that keepalive is async while transactions are sync public final Queue> transactionsSent = new ConcurrentLinkedQueue<>(); - public final List didWeSendThatTrans = Collections.synchronizedList(new ArrayList<>()); + public final Set didWeSendThatTrans = ConcurrentHashMap.newKeySet(); private final AtomicInteger transactionIDCounter = new AtomicInteger(0); public AtomicInteger lastTransactionSent = new AtomicInteger(0); public AtomicInteger lastTransactionReceived = new AtomicInteger(0);