Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
Port improve chunk status transition speed
Dieser Commit ist enthalten in:
Ursprung
2b3c483a98
Commit
05623c47ec
@ -3,10 +3,6 @@ From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 29 May 2020 23:32:14 -0400
|
||||
Subject: [PATCH] Improve Chunk Status Transition Speed
|
||||
|
||||
|
||||
1.17 Update note: Depends on not yet applied patch: Implement Chunk Priority / Urgency System for Chunks
|
||||
|
||||
|
||||
When a chunk is loaded from disk that has already been generated,
|
||||
the server has to promote the chunk through the system to reach
|
||||
it's current desired status level.
|
||||
@ -40,10 +36,10 @@ scenario / path:
|
||||
Previously would have hopped to SERVER around 12+ times there extra.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
index ce320672d7602c94dd75ad857435dca6ac3bab56..8260636da673ef095728c208db2d6237bab2db19 100644
|
||||
index 377993f325400a9bc77f5fbc77d9ec50f5d76638..c28f693bf7da42570d95ab97ccb0ec2bf06f53ee 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -83,6 +83,13 @@ public class ChunkHolder {
|
||||
@@ -240,6 +240,13 @@ public class ChunkHolder {
|
||||
this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key);
|
||||
}
|
||||
// Paper end - optimise isOutsideOfRange
|
||||
@ -51,17 +47,17 @@ index ce320672d7602c94dd75ad857435dca6ac3bab56..8260636da673ef095728c208db2d6237
|
||||
+ public boolean canAdvanceStatus() {
|
||||
+ ChunkStatus status = getChunkHolderStatus();
|
||||
+ ChunkAccess chunk = getAvailableChunkNow();
|
||||
+ return chunk != null && (status == null || chunk.getStatus().isAtLeastStatus(getNextStatus(status)));
|
||||
+ return chunk != null && (status == null || chunk.getStatus().isOrAfter(getNextStatus(status)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
// Paper start - no-tick view distance
|
||||
public final LevelChunk getSendingChunk() {
|
||||
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
|
||||
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 7a1f6d1807757a43a7aa471db651404c06720820..acc566d14926dcf9e88f3e0837884e4c823d777c 100644
|
||||
index c544529908dd5af63a829f54985eefc236e290db..4c8e5e3e69c629485b7118dfcc1eb04ac3c5f6c9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -792,7 +792,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -838,7 +838,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return either.mapLeft((list) -> {
|
||||
return (LevelChunk) list.get(list.size() / 2);
|
||||
});
|
||||
@ -70,28 +66,10 @@ index 7a1f6d1807757a43a7aa471db651404c06720820..acc566d14926dcf9e88f3e0837884e4c
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1142,7 +1142,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
ChunkAccess ichunkaccess = (ChunkAccess) optional.get();
|
||||
|
||||
if (ichunkaccess.getStatus().isOrAfter(requiredStatus)) {
|
||||
- CompletableFuture completablefuture1;
|
||||
+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture1; // Paper
|
||||
|
||||
if (requiredStatus == ChunkStatus.LIGHT) {
|
||||
completablefuture1 = this.scheduleChunkGeneration(holder, requiredStatus);
|
||||
@@ -1158,7 +1158,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return this.scheduleChunkGeneration(holder, requiredStatus);
|
||||
}
|
||||
}
|
||||
- }, this.mainThreadExecutor);
|
||||
+ }, this.mainInvokingExecutor).thenComposeAsync(CompletableFuture::completedFuture, this.mainInvokingExecutor); // Paper - optimize chunk status progression without jumping through thread pool - ensure main
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1279,6 +1279,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
|
||||
@@ -1222,6 +1222,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return "chunkGenerate " + requiredStatus.getName();
|
||||
});
|
||||
}, (runnable) -> {
|
||||
Executor executor = (runnable) -> {
|
||||
+ // Paper start - optimize chunk status progression without jumping through thread pool
|
||||
+ if (holder.canAdvanceStatus()) {
|
||||
+ this.mainInvokingExecutor.execute(runnable);
|
||||
@ -99,5 +77,5 @@ index 7a1f6d1807757a43a7aa471db651404c06720820..acc566d14926dcf9e88f3e0837884e4c
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.worldgenMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add zombie targets turtle egg config
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 2216fc05ef5f1c2f7e4dcab7bb20b9944838c5f4..f3d98b40b5adb5b6aa76371e9d3eb974b551d4f3 100644
|
||||
index 9e5810eb0085ad956f0bd1cd69fa88909d9d638a..fbd433f7d48282365c73e2a76f14c2755b49d930 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -38,6 +38,11 @@ public class PaperWorldConfig {
|
@ -19,7 +19,7 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
|
||||
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index f3d98b40b5adb5b6aa76371e9d3eb974b551d4f3..b1ae749b2178dc8c49a7adf4a3e93339d8b99dfb 100644
|
||||
index fbd433f7d48282365c73e2a76f14c2755b49d930..1ecf4ba21f0e7dd620804d952e11140ffd5af30b 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -43,6 +43,16 @@ public class PaperWorldConfig {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086)
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
index 377993f325400a9bc77f5fbc77d9ec50f5d76638..6be677e618ca5b5d5a969a02e77457dd6e3d2e11 100644
|
||||
index c28f693bf7da42570d95ab97ccb0ec2bf06f53ee..bcb2750a1b3a8cef6eb4e22c6409f77614390f7b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -373,6 +373,7 @@ public class ChunkHolder {
|
||||
@@ -380,6 +380,7 @@ public class ChunkHolder {
|
||||
}
|
||||
|
||||
public void blockChanged(BlockPos pos) {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Toggle for removing existing dragon
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index b1ae749b2178dc8c49a7adf4a3e93339d8b99dfb..c484da4558e918c1456588e540a3b34e78581f81 100644
|
||||
index 1ecf4ba21f0e7dd620804d952e11140ffd5af30b..1f673932e329f7e713a37a8c06345a184650f0eb 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -53,6 +53,14 @@ public class PaperWorldConfig {
|
@ -21,7 +21,7 @@ changes but this should usually not happen. A config option to disable
|
||||
this completely is added though in case that should ever be necessary.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index c484da4558e918c1456588e540a3b34e78581f81..cac404e1c7ede7b1076532555d35e6c18f158b16 100644
|
||||
index 1f673932e329f7e713a37a8c06345a184650f0eb..a3c76e0515ee38cb5dc55e7dbf3f91cac5ef4c28 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -361,6 +361,14 @@ public class PaperWorldConfig {
|
@ -11,7 +11,7 @@ in IWorldServerData are removed as they were only used in certain places, with h
|
||||
values used in other places.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index cac404e1c7ede7b1076532555d35e6c18f158b16..f4b533b8e8b6c4bb59d032e91a94353f4b201b69 100644
|
||||
index a3c76e0515ee38cb5dc55e7dbf3f91cac5ef4c28..5f25edb32b3e1194cf03c19574fc2ebd07b9a15e 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -61,6 +61,19 @@ public class PaperWorldConfig {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index f4b533b8e8b6c4bb59d032e91a94353f4b201b69..5344d25e7bef34954aa058ec019b4ba8ab4de515 100644
|
||||
index 5f25edb32b3e1194cf03c19574fc2ebd07b9a15e..edf82e84c2938ed70d51eb1199a4e92504c8c604 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -74,6 +74,11 @@ public class PaperWorldConfig {
|
@ -8,7 +8,7 @@ and curing a villager on repeat by simply resetting the relevant part of
|
||||
the reputation when it is cured.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 5344d25e7bef34954aa058ec019b4ba8ab4de515..cf8bc5432de023968ecdae6e48045c93021ad243 100644
|
||||
index edf82e84c2938ed70d51eb1199a4e92504c8c604..89bab0807b568cd19e3c84cc1314bdbb6463fb7e 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -79,6 +79,11 @@ public class PaperWorldConfig {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Allow disabling mob spawner spawn egg transformation
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index cf8bc5432de023968ecdae6e48045c93021ad243..f1cc0579654877fde716a3f99e4ea28044941b4b 100644
|
||||
index 89bab0807b568cd19e3c84cc1314bdbb6463fb7e..592717db9c9e8efda88c6a464c51a5d76f9694dc 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -84,6 +84,11 @@ public class PaperWorldConfig {
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren