diff --git a/patches/server/Optimize-MappedRegistry.patch b/patches/server/Optimize-MappedRegistry.patch index 84be297eb8..fb7e639aba 100644 --- a/patches/server/Optimize-MappedRegistry.patch +++ b/patches/server/Optimize-MappedRegistry.patch @@ -16,13 +16,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 final ResourceKey> key; private final ObjectList> byId = new ObjectArrayList<>(256); - private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(), (map) -> { -- map.defaultReturnValue(-1); -- }); ++ private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(2048), (map) -> { // Paper - use bigger expected size to reduce collisions + map.defaultReturnValue(-1); + }); - private final Map> byLocation = new HashMap<>(); - private final Map, Holder.Reference> byKey = new HashMap<>(); - private final Map> byValue = new IdentityHashMap<>(); - private final Map lifecycles = new IdentityHashMap<>(); -+ private final Reference2IntMap toId = new Reference2IntOpenHashMap(2048);// Paper - use bigger expected size to reduce collisions and direct intent for FastUtil to be identity map + private final Map> byLocation = new HashMap<>(2048); // Paper - use bigger expected size to reduce collisions + private final Map, Holder.Reference> byKey = new HashMap<>(2048); // Paper - use bigger expected size to reduce collisions + private final Map> byValue = new IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions @@ -30,11 +30,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private Lifecycle registryLifecycle; private volatile Map, HolderSet.Named> tags = new IdentityHashMap<>(); private boolean frozen; -@@ -0,0 +0,0 @@ public class MappedRegistry implements WritableRegistry { - } - - public MappedRegistry(ResourceKey> key, Lifecycle lifecycle, boolean intrusive) { -+ this.toId.defaultReturnValue(-1); // Paper - this.key = key; - this.registryLifecycle = lifecycle; - if (intrusive) {