Paper/patches/server/0129-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch

37 lines
2.0 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 7 Feb 2017 16:55:35 -0600
Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index e1200e903e39c3e5cb023e1bd4fe104907c0c6eb..702d885b6a5caf8cabc40934893a081b01906781 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -232,7 +232,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.entityMap = new Int2ObjectOpenHashMap();
this.chunkTypeCache = new Long2ByteOpenHashMap();
2022-03-01 06:43:03 +01:00
this.chunkSaveCooldowns = new Long2LongOpenHashMap();
- this.unloadQueue = Queues.newConcurrentLinkedQueue();
2022-03-01 06:43:03 +01:00
+ this.unloadQueue = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size()
2022-06-07 22:12:48 +02:00
this.structureTemplateManager = structureTemplateManager;
2021-11-30 08:32:30 +01:00
Path path = session.getDimensionPath(world.dimension());
2021-07-07 08:52:40 +02:00
@@ -587,7 +587,6 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private void processUnloads(BooleanSupplier shouldKeepTicking) {
LongIterator longiterator = this.toDrop.iterator();
-
for (int i = 0; longiterator.hasNext() && (shouldKeepTicking.getAsBoolean() || i < 200 || this.toDrop.size() > 2000); longiterator.remove()) {
long j = longiterator.nextLong();
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j);
@@ -600,7 +599,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
2021-11-30 08:32:30 +01:00
}
2021-11-30 08:32:30 +01:00
- int k = Math.max(0, this.unloadQueue.size() - 2000);
+ int k = Math.max(100, this.unloadQueue.size() - 2000); // Paper - Unload more than just up to queue size 2000
2021-11-30 08:32:30 +01:00
Runnable runnable;