Paper/Spigot-Server-Patches/0168-Fix-MC-117075-TE-Unload-Lag-Spike.patch
Shane Freeder b16fd5c3a3
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
6148fca7 SPIGOT-5484: Add more spawn tick settings

CraftBukkit Changes:
fc249340 SPIGOT-5484: Add more spawn tick settings

Spigot Changes:
6de3d4be Rebuild patches
2020-03-10 11:01:21 +00:00

27 lines
1.3 KiB
Diff

From a7f54212cb9fc405240c8bd0cb90bcccb0c3ccec Mon Sep 17 00:00:00 2001
From: mezz <tehgeek@gmail.com>
Date: Wed, 9 Aug 2017 17:51:22 -0500
Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index ff14c265b..bfb682ebb 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -645,7 +645,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.enter("blockEntities");
timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) {
- this.tileEntityListTick.removeAll(this.tileEntityListUnload);
+ // Paper start - Use alternate implementation with faster contains
+ java.util.Set<TileEntity> toRemove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
+ toRemove.addAll(tileEntityListUnload);
+ this.tileEntityListTick.removeAll(toRemove);
+ // Paper end
//this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
this.tileEntityListUnload.clear();
}
--
2.25.0