mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
36 lines
2 KiB
Diff
36 lines
2 KiB
Diff
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 1c73599e37e9b830ff0ab9bcc9edc7b63daa6ca1..dd318c213742299fca1335fadf1f4465b471d7ea 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -233,7 +233,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
this.entityMap = new Int2ObjectOpenHashMap();
|
|
this.chunkTypeCache = new Long2ByteOpenHashMap();
|
|
this.chunkSaveCooldowns = new Long2LongOpenHashMap();
|
|
- this.unloadQueue = Queues.newConcurrentLinkedQueue();
|
|
+ this.unloadQueue = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size()
|
|
this.structureTemplateManager = structureTemplateManager;
|
|
Path path = session.getDimensionPath(world.dimension());
|
|
|
|
@@ -588,7 +588,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);
|
|
@@ -601,7 +600,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}
|
|
}
|
|
|
|
- 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
|
|
|
|
Runnable runnable;
|
|
|