diff options
Diffstat (limited to 'patches/server/0752-Oprimise-map-impl-for-tracked-players.patch')
-rw-r--r-- | patches/server/0752-Oprimise-map-impl-for-tracked-players.patch | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/patches/server/0752-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0752-Oprimise-map-impl-for-tracked-players.patch new file mode 100644 index 0000000000..e1ee820045 --- /dev/null +++ b/patches/server/0752-Oprimise-map-impl-for-tracked-players.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf <[email protected]> +Date: Fri, 19 Feb 2021 22:51:52 -0800 +Subject: [PATCH] Oprimise map impl for tracked players + +Reference2BooleanOpenHashMap is going to have +better lookups than HashMap. + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index e811c7d617b8c9cc684bc0a58a98d5ecfe11db02..f47e2d4a7343f3e3ee68f36688720cedc58861dc 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -110,6 +110,7 @@ import org.slf4j.Logger; + import org.bukkit.craftbukkit.generator.CustomChunkGenerator; + import org.bukkit.entity.Player; + // CraftBukkit end ++import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Paper + + public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider { + +@@ -2212,7 +2213,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + final Entity entity; + private final int range; + SectionPos lastSectionPos; +- public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet(); ++ public final Set<ServerPlayerConnection> seenBy = new ReferenceOpenHashSet<>(); // Paper - optimise map impl + + public TrackedEntity(Entity entity, int i, int j, boolean flag) { + this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit |