From 8998bc7c8f427080cd46f2026901dc034ea55741 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 10 Aug 2018 20:56:22 -0400 Subject: [PATCH] Presize the maps. TODO: Replace that ugly autoboxed primitive without excessively blowing up the size of the JAR --- .../com/velocitypowered/proxy/protocol/StateRegistry.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java index 43f79eb8e..79cfc4942 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -167,7 +167,7 @@ public enum StateRegistry { private final ProtocolConstants.Direction direction; private final StateRegistry state; - private final IntObjectMap versions = new IntObjectHashMap<>(); + private final IntObjectMap versions = new IntObjectHashMap<>(16); public PacketRegistry(Direction direction, StateRegistry state) { this.direction = direction; @@ -216,8 +216,8 @@ public enum StateRegistry { public class ProtocolVersion { public final int id; - final IntObjectMap> packetIdToSupplier = new IntObjectHashMap<>(); - final Map, Integer> packetClassToId = new HashMap<>(); + final IntObjectMap> packetIdToSupplier = new IntObjectHashMap<>(16, 0.5f); + final Map, Integer> packetClassToId = new HashMap<>(16, 0.5f); ProtocolVersion(final int id) { this.id = id;