aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0610-Oprimise-map-impl-for-tracked-players.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0610-Oprimise-map-impl-for-tracked-players.patch')
-rw-r--r--patches/server/0610-Oprimise-map-impl-for-tracked-players.patch21
1 files changed, 21 insertions, 0 deletions
diff --git a/patches/server/0610-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0610-Oprimise-map-impl-for-tracked-players.patch
new file mode 100644
index 0000000000..891e360d2c
--- /dev/null
+++ b/patches/server/0610-Oprimise-map-impl-for-tracked-players.patch
@@ -0,0 +1,21 @@
+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 161792d0226dbb50e9f5ab5c0fe42cc73f44c2a8..b95690dc28dbe8420b0054205c50d14de79f7a42 100644
+--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
+@@ -1466,7 +1466,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 it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - Perf: optimise map impl
+
+ public TrackedEntity(final Entity entity, final int i, final int j, final boolean flag) {
+ this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit