mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Reduce chunk range timers
This commit is contained in:
parent
a52f8eeeac
commit
a3cce96f9b
3 changed files with 20 additions and 35 deletions
|
@ -121,12 +121,12 @@ tasks required to be executed by the chunk load task (i.e lighting
|
|||
and some poi tasks).
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
index 3a79cde595..8de6c4816c 100644
|
||||
index e41083f14c..8a3f30c36f 100644
|
||||
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
@@ -0,0 +0,0 @@ public class WorldTimingsHandler {
|
||||
public final Timing chunkRangeCheckBig;
|
||||
public final Timing chunkRangeCheckSmall;
|
||||
public final Timing miscMobSpawning;
|
||||
public final Timing chunkInhibitedRangeCheck;
|
||||
|
||||
+ public final Timing poiUnload;
|
||||
+ public final Timing chunkUnload;
|
||||
|
@ -143,9 +143,9 @@ index 3a79cde595..8de6c4816c 100644
|
|||
String name = server.worldData.getName() +" - ";
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldTimingsHandler {
|
||||
|
||||
chunkInhibitedRangeCheck = Timings.ofSafe(name + "Chunks - Inhibited Range Check");
|
||||
miscMobSpawning = Timings.ofSafe(name + "Mob spawning - Misc");
|
||||
chunkRangeCheckBig = Timings.ofSafe(name + "Chunk Tick Range - Big");
|
||||
chunkRangeCheckSmall = Timings.ofSafe(name + "Chunk Tick Range - Small");
|
||||
+
|
||||
+ poiUnload = Timings.ofSafe(name + "Chunk unload - POI");
|
||||
+ chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk");
|
||||
|
@ -2361,7 +2361,7 @@ index 0000000000..715a2dd8d2
|
|||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 296f69a0ac..31377fd4af 100644
|
||||
index a57371b08e..e8166bc812 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
|
|
@ -153,7 +153,7 @@ index 0000000000..69e26a8267
|
|||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
new file mode 100644
|
||||
index 0000000000..3a79cde595
|
||||
index 0000000000..e41083f14c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -219,8 +219,7 @@ index 0000000000..3a79cde595
|
|||
+
|
||||
+
|
||||
+ public final Timing miscMobSpawning;
|
||||
+ public final Timing chunkRangeCheckBig;
|
||||
+ public final Timing chunkRangeCheckSmall;
|
||||
+ public final Timing chunkInhibitedRangeCheck;
|
||||
+
|
||||
+ public WorldTimingsHandler(World server) {
|
||||
+ String name = server.worldData.getName() +" - ";
|
||||
|
@ -278,9 +277,8 @@ index 0000000000..3a79cde595
|
|||
+ countNaturalMobs = Timings.ofSafe(name + "Count natural mobs");
|
||||
+
|
||||
+
|
||||
+ chunkInhibitedRangeCheck = Timings.ofSafe(name + "Chunks - Inhibited Range Check");
|
||||
+ miscMobSpawning = Timings.ofSafe(name + "Mob spawning - Misc");
|
||||
+ chunkRangeCheckBig = Timings.ofSafe(name + "Chunk Tick Range - Big");
|
||||
+ chunkRangeCheckSmall = Timings.ofSafe(name + "Chunk Tick Range - Small");
|
||||
+ }
|
||||
+
|
||||
+ public static Timing getTickList(WorldServer worldserver, String timingsType) {
|
||||
|
@ -375,7 +373,7 @@ index e58dd3e6df..0b32179b79 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index f558ae4417..2107ddc48f 100644
|
||||
index f558ae4417..63cb0019b1 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
@ -437,26 +435,12 @@ index f558ae4417..2107ddc48f 100644
|
|||
this.world.getMethodProfiler().exit();
|
||||
ChunkCoordIntPair chunkcoordintpair = playerchunk.i();
|
||||
|
||||
- if (!this.playerChunkMap.isOutsideOfRange(chunkcoordintpair)) {
|
||||
+ // Paper start - timings
|
||||
+ this.world.timings.chunkRangeCheckBig.startTiming();
|
||||
+ // note: this is just a copy of the expression in the if
|
||||
+ boolean bigRadiusOutsideRange = !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair);
|
||||
+ this.world.timings.chunkRangeCheckBig.stopTiming();
|
||||
+ if (bigRadiusOutsideRange) {
|
||||
+ this.world.timings.chunkInhibitedRangeCheck.startTiming();
|
||||
if (!this.playerChunkMap.isOutsideOfRange(chunkcoordintpair)) {
|
||||
+ // Paper end
|
||||
chunk.setInhabitedTime(chunk.getInhabitedTime() + j);
|
||||
- if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot
|
||||
+ // Paper start - timings
|
||||
+ this.world.timings.chunkRangeCheckSmall.startTiming();
|
||||
+ // note: this is just a copy of the expression in the if
|
||||
+ boolean smallRadiusOutsideRange = flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true);
|
||||
+ this.world.timings.chunkRangeCheckSmall.stopTiming();
|
||||
+ if (smallRadiusOutsideRange) { // Spigot
|
||||
+ // Paper end
|
||||
if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot
|
||||
this.world.getMethodProfiler().enter("spawner");
|
||||
this.world.timings.mobSpawn.startTiming(); // Spigot
|
||||
EnumCreatureType[] aenumcreaturetype1 = aenumcreaturetype;
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.getMethodProfiler().exit();
|
||||
}
|
||||
|
@ -467,6 +451,7 @@ index f558ae4417..2107ddc48f 100644
|
|||
- this.world.timings.doTickTiles.stopTiming(); // Spigot
|
||||
+ this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper
|
||||
}
|
||||
+ this.world.timings.chunkInhibitedRangeCheck.stopTiming(); // Paper
|
||||
}
|
||||
});
|
||||
this.world.getMethodProfiler().enter("customSpawners");
|
||||
|
|
|
@ -5,21 +5,21 @@ Subject: [PATCH] implement optional per player mob spawns
|
|||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
index 8de6c4816c..e25544f116 100644
|
||||
index 8a3f30c36f..51281cfa2d 100644
|
||||
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
@@ -0,0 +0,0 @@ public class WorldTimingsHandler {
|
||||
|
||||
public final Timing miscMobSpawning;
|
||||
public final Timing chunkRangeCheckBig;
|
||||
public final Timing chunkRangeCheckSmall;
|
||||
public final Timing chunkInhibitedRangeCheck;
|
||||
+ public final Timing playerMobDistanceMapUpdate;
|
||||
|
||||
public final Timing poiUnload;
|
||||
public final Timing chunkUnload;
|
||||
@@ -0,0 +0,0 @@ public class WorldTimingsHandler {
|
||||
|
||||
chunkInhibitedRangeCheck = Timings.ofSafe(name + "Chunks - Inhibited Range Check");
|
||||
miscMobSpawning = Timings.ofSafe(name + "Mob spawning - Misc");
|
||||
chunkRangeCheckBig = Timings.ofSafe(name + "Chunk Tick Range - Big");
|
||||
chunkRangeCheckSmall = Timings.ofSafe(name + "Chunk Tick Range - Small");
|
||||
+ playerMobDistanceMapUpdate = Timings.ofSafe(name + "Per Player Mob Spawning - Distance Map Update");
|
||||
|
||||
poiUnload = Timings.ofSafe(name + "Chunk unload - POI");
|
||||
|
@ -545,7 +545,7 @@ index 0000000000..4f13d3ff83
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 93b4e6117f..7db96cec40 100644
|
||||
index 6adb31d854..a0839ac725 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
|
Loading…
Reference in a new issue