From 4f0fe72add708a08fb405b3e56803668ed8ec807 Mon Sep 17 00:00:00 2001 From: Aseeef <74121396+Aseeef@users.noreply.github.com> Date: Sun, 12 Mar 2023 14:05:19 -0400 Subject: [PATCH] Use ConcurrentHashMap to improve performance (#2226) * modified hashset collections for small performance gains * reverted load factor modification since no noticeable performance gain was seen --------- Co-authored-by: aseef --- .../protocol/injector/netty/channel/NettyChannelInjector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/comphenix/protocol/injector/netty/channel/NettyChannelInjector.java b/src/main/java/com/comphenix/protocol/injector/netty/channel/NettyChannelInjector.java index 125bb00e..19ae3238 100644 --- a/src/main/java/com/comphenix/protocol/injector/netty/channel/NettyChannelInjector.java +++ b/src/main/java/com/comphenix/protocol/injector/netty/channel/NettyChannelInjector.java @@ -101,7 +101,7 @@ public class NettyChannelInjector implements Injector { // packet marking private final Map savedMarkers = new WeakHashMap<>(16, 0.9f); - private final Set skippedPackets = Collections.synchronizedSet(new HashSet<>()); + private final Set skippedPackets = ConcurrentHashMap.newKeySet(); protected final ThreadLocal processedPackets = ThreadLocal.withInitial(() -> Boolean.FALSE); // status of this injector