2021-06-12 09:01:04 +00:00
|
|
|
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
|
2022-07-27 19:49:24 +00:00
|
|
|
index 1c73599e37e9b830ff0ab9bcc9edc7b63daa6ca1..dd318c213742299fca1335fadf1f4465b471d7ea 100644
|
2021-06-12 09:01:04 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
2022-07-27 19:49:24 +00:00
|
|
|
@@ -233,7 +233,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
2021-06-12 09:01:04 +00:00
|
|
|
this.entityMap = new Int2ObjectOpenHashMap();
|
|
|
|
this.chunkTypeCache = new Long2ByteOpenHashMap();
|
2022-03-01 05:43:03 +00:00
|
|
|
this.chunkSaveCooldowns = new Long2LongOpenHashMap();
|
2021-06-12 09:01:04 +00:00
|
|
|
- this.unloadQueue = Queues.newConcurrentLinkedQueue();
|
2022-03-01 05:43:03 +00:00
|
|
|
+ this.unloadQueue = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size()
|
2022-06-07 20:12:48 +00:00
|
|
|
this.structureTemplateManager = structureTemplateManager;
|
2021-11-30 07:32:30 +00:00
|
|
|
Path path = session.getDimensionPath(world.dimension());
|
2021-07-07 06:52:40 +00:00
|
|
|
|
2022-07-27 19:49:24 +00:00
|
|
|
@@ -588,7 +588,6 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
2022-03-13 07:47:54 +00:00
|
|
|
|
|
|
|
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()) {
|
2021-06-12 09:01:04 +00:00
|
|
|
long j = longiterator.nextLong();
|
2022-03-13 07:47:54 +00:00
|
|
|
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j);
|
2022-07-27 19:49:24 +00:00
|
|
|
@@ -601,7 +600,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
2022-03-13 07:47:54 +00:00
|
|
|
}
|
2021-11-30 07:32:30 +00:00
|
|
|
}
|
2021-06-12 09:01:04 +00:00
|
|
|
|
2021-11-30 07:32:30 +00:00
|
|
|
- int k = Math.max(0, this.unloadQueue.size() - 2000);
|
2022-03-13 07:47:54 +00:00
|
|
|
+ int k = Math.max(100, this.unloadQueue.size() - 2000); // Paper - Unload more than just up to queue size 2000
|
2021-06-12 09:01:04 +00:00
|
|
|
|
2021-11-30 07:32:30 +00:00
|
|
|
Runnable runnable;
|
2021-06-12 09:01:04 +00:00
|
|
|
|