Presize the maps.

TODO: Replace that ugly autoboxed primitive without excessively blowing
up the size of the JAR
This commit is contained in:
Andrew Steinborn
2018-08-10 20:56:22 -04:00
parent 738be8d535
commit 8998bc7c8f

View File

@@ -167,7 +167,7 @@ public enum StateRegistry {
private final ProtocolConstants.Direction direction;
private final StateRegistry state;
private final IntObjectMap<ProtocolVersion> versions = new IntObjectHashMap<>();
private final IntObjectMap<ProtocolVersion> 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<Supplier<? extends MinecraftPacket>> packetIdToSupplier = new IntObjectHashMap<>();
final Map<Class<? extends MinecraftPacket>, Integer> packetClassToId = new HashMap<>();
final IntObjectMap<Supplier<? extends MinecraftPacket>> packetIdToSupplier = new IntObjectHashMap<>(16, 0.5f);
final Map<Class<? extends MinecraftPacket>, Integer> packetClassToId = new HashMap<>(16, 0.5f);
ProtocolVersion(final int id) {
this.id = id;