Skip to content

Commit

Permalink
Timings changes (PaperMC#3044)
Browse files Browse the repository at this point in the history
* Timings changes

- Increment entity tick count only when an entity ticks
- Remove chunk inhabited timer
- Try finally entity timings

* Add activated entity ticks

Co-authored-by: Spottedleaf <[email protected]>
  • Loading branch information
Spottedleaf and Spottedleaf authored Mar 19, 2020
1 parent d63075d commit 49fdb18
Show file tree
Hide file tree
Showing 29 changed files with 273 additions and 257 deletions.
118 changes: 67 additions & 51 deletions Spigot-Server-Patches/0009-Timings-v2.patch

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Spigot-Server-Patches/0025-Entity-Origin-API.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 85a4e1989ff00a6ab9e60fa579668fd022f752f1 Mon Sep 17 00:00:00 2001
From eb19fb35a1fda6531c127beafb36cb5098174202 Mon Sep 17 00:00:00 2001
From: Byteflux <[email protected]>
Date: Tue, 1 Mar 2016 23:45:08 -0600
Subject: [PATCH] Entity Origin API
Expand Down Expand Up @@ -101,10 +101,10 @@ index 5406f4c40f..d778eac45d 100644
if (i >= 0 && i < this.list.size()) {
NBTBase nbtbase = (NBTBase) this.list.get(i);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 069898bad7..ce9bad42f8 100644
index 6810d49b17..450b414298 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1176,6 +1176,11 @@ public class WorldServer extends World {
@@ -1180,6 +1180,11 @@ public class WorldServer extends World {
this.navigators.add(((EntityInsentient) entity).getNavigation());
}
entity.valid = true; // CraftBukkit
Expand Down Expand Up @@ -134,5 +134,5 @@ index c82c213260..a296936748 100644
+ // Paper end
}
--
2.25.0
2.25.2

10 changes: 5 additions & 5 deletions Spigot-Server-Patches/0034-Disable-thunder.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
From af390b8d5170b906a3d0ffe790f153f561f9e511 Mon Sep 17 00:00:00 2001
From d04b0dfb3bb79611afbde1887e6d87b9a66f9327 Mon Sep 17 00:00:00 2001
From: Sudzzy <[email protected]>
Date: Wed, 2 Mar 2016 14:52:43 -0600
Subject: [PATCH] Disable thunder


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 25e071718..41436a4ea 100644
index 25e0717186..41436a4ead 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -161,4 +161,9 @@ public class PaperWorldConfig {
Expand All @@ -19,10 +19,10 @@ index 25e071718..41436a4ea 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 948438829..5adb59172 100644
index 5e760818fb..3ba54917af 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -446,7 +446,7 @@ public class WorldServer extends World {
@@ -445,7 +445,7 @@ public class WorldServer extends World {
gameprofilerfiller.enter("thunder");
BlockPosition blockposition;

Expand All @@ -32,5 +32,5 @@ index 948438829..5adb59172 100644
if (this.isRainingAt(blockposition)) {
DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
--
2.25.0.windows.1
2.25.2

10 changes: 5 additions & 5 deletions Spigot-Server-Patches/0035-Disable-ice-and-snow.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
From 113e75e1dda3f6ba8ec9bef997ab5068c2cf4de0 Mon Sep 17 00:00:00 2001
From 57e7eb12376863a7faa4fba8cce5b5fec37f0767 Mon Sep 17 00:00:00 2001
From: Sudzzy <[email protected]>
Date: Wed, 2 Mar 2016 14:57:24 -0600
Subject: [PATCH] Disable ice and snow


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 41436a4ea..f53d8b967 100644
index 41436a4ead..f53d8b9675 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -166,4 +166,9 @@ public class PaperWorldConfig {
Expand All @@ -19,10 +19,10 @@ index 41436a4ea..f53d8b967 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 5adb59172..173e3857e 100644
index 3ba54917af..4309a7d07a 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -466,7 +466,7 @@ public class WorldServer extends World {
@@ -465,7 +465,7 @@ public class WorldServer extends World {
}

gameprofilerfiller.exitEnter("iceandsnow");
Expand All @@ -32,5 +32,5 @@ index 5adb59172..173e3857e 100644
BlockPosition blockposition1 = blockposition.down();
BiomeBase biomebase = this.getBiome(blockposition);
--
2.25.0.windows.1
2.25.2

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
From 9290f564d1b0d7b30aa8449be4bce60228f0d23f Mon Sep 17 00:00:00 2001
From 35098d52136374f24614dff5fc274a738a65a358 Mon Sep 17 00:00:00 2001
From: Zach Brown <[email protected]>
Date: Tue, 22 Mar 2016 12:04:28 -0500
Subject: [PATCH] Configurable spawn chances for skeleton horses


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 7de7b74ff..6ef0e1399 100644
index 7de7b74ff6..6ef0e1399e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -228,4 +228,12 @@ public class PaperWorldConfig {
Expand All @@ -22,10 +22,10 @@ index 7de7b74ff..6ef0e1399 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 173e3857e..0146573a3 100644
index 4309a7d07a..47d177b13d 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -450,7 +450,7 @@ public class WorldServer extends World {
@@ -449,7 +449,7 @@ public class WorldServer extends World {
blockposition = this.a(this.a(j, 0, k, 15));
if (this.isRainingAt(blockposition)) {
DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
Expand All @@ -35,5 +35,5 @@ index 173e3857e..0146573a3 100644
if (flag1) {
EntityHorseSkeleton entityhorseskeleton = (EntityHorseSkeleton) EntityTypes.SKELETON_HORSE.a((World) this);
--
2.25.0.windows.1
2.25.2

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From b510c1a11e27b982e5a084ed3303c975eb3c36b9 Mon Sep 17 00:00:00 2001
From e7c4bd8bdfdae92f7a47353b1b3a1bd50721f93f Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Mon, 28 Mar 2016 20:32:58 -0400
Subject: [PATCH] Entity AddTo/RemoveFrom World Events


diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 4e29746c14..dac6e10d25 100644
index 9d0edf5382..fd42f34004 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1144,7 +1144,7 @@ public class WorldServer extends World {
@@ -1148,7 +1148,7 @@ public class WorldServer extends World {
if (entity instanceof EntityInsentient) {
this.navigators.remove(((EntityInsentient) entity).getNavigation());
}
Expand All @@ -17,7 +17,7 @@ index 4e29746c14..dac6e10d25 100644
entity.valid = false; // CraftBukkit
}

@@ -1182,6 +1182,7 @@ public class WorldServer extends World {
@@ -1186,6 +1186,7 @@ public class WorldServer extends World {
entity.origin = entity.getBukkitEntity().getLocation();
}
// Paper end
Expand All @@ -26,5 +26,5 @@ index 4e29746c14..dac6e10d25 100644

}
--
2.25.0.windows.1
2.25.2

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
From 05e214f72ca86351ac42b9c56a191fedf7d9e2e4 Mon Sep 17 00:00:00 2001
From 77aec9ad41160932726decb27ba49c3f1b7a485d Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Wed, 13 Apr 2016 00:25:28 -0400
Subject: [PATCH] Remove unused World Tile Entity List

Massive hit to performance and it is completely unnecessary.

diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9672248c7..1dccc2e0d 100644
index 9672248c7c..1dccc2e0dd 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -36,7 +36,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
Expand Down Expand Up @@ -67,10 +67,10 @@ index 9672248c7..1dccc2e0d 100644
}

diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 2f1857dbb..92745505a 100644
index fd42f34004..6f66c38650 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1629,7 +1629,7 @@ public class WorldServer extends World {
@@ -1633,7 +1633,7 @@ public class WorldServer extends World {
}

bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size()));
Expand All @@ -79,7 +79,7 @@ index 2f1857dbb..92745505a 100644
bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a()));
bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a()));
bufferedwriter.write("distance_manager: " + playerchunkmap.e().c() + "\n");
@@ -1792,7 +1792,7 @@ public class WorldServer extends World {
@@ -1796,7 +1796,7 @@ public class WorldServer extends World {

private void a(Writer writer) throws IOException {
CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer);
Expand All @@ -89,5 +89,5 @@ index 2f1857dbb..92745505a 100644
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
--
2.25.0
2.25.2

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From cfca191373edfe3183204448a202e179a526e830 Mon Sep 17 00:00:00 2001
From 5a352e939e763bd487f3d7e9eb075e108875e264 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Fri, 29 Apr 2016 20:02:00 -0400
Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes
Expand Down Expand Up @@ -102,10 +102,10 @@ index a56ac3da80..2f1be1995d 100644
for ( org.bukkit.map.MapCursor cursor : render.cursors) {

diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 7b3e3487fa..23f3d7eb51 100644
index 6f66c38650..40c9cba760 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1105,6 +1105,7 @@ public class WorldServer extends World {
@@ -1109,6 +1109,7 @@ public class WorldServer extends World {
{
if ( iter.next().trackee == entity )
{
Expand All @@ -127,5 +127,5 @@ index 256a131781..5768cd512e 100644

public RenderData() {
--
2.25.0.windows.1
2.25.2

8 changes: 4 additions & 4 deletions Spigot-Server-Patches/0107-Fix-Double-World-Add-issues.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 188c4e80539d150665d81235bc988b53d4fc932c Mon Sep 17 00:00:00 2001
From 61b790005fc01a2e5519c426d6ff0ac80e672f2b Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Tue, 21 Jun 2016 22:54:34 -0400
Subject: [PATCH] Fix Double World Add issues
Expand All @@ -8,10 +8,10 @@ Vanilla will double add Spider Jockeys to the world, so ignore already added.
Also add debug if something else tries to, and abort before world gets bad state

diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 23f3d7eb51..e69f82dcd1 100644
index 40c9cba760..3004270455 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -994,6 +994,7 @@ public class WorldServer extends World {
@@ -998,6 +998,7 @@ public class WorldServer extends World {
// CraftBukkit start
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
Expand All @@ -20,5 +20,5 @@ index 23f3d7eb51..e69f82dcd1 100644
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
return false;
--
2.25.0.windows.1
2.25.2

8 changes: 4 additions & 4 deletions Spigot-Server-Patches/0116-Chunk-registration-fixes.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From fc323bdca782d5ee6048969638c3ca5f2c6908fb Mon Sep 17 00:00:00 2001
From 0e5fdda0a14744d8d2b6bab930db5ac11d159d31 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
Expand All @@ -8,10 +8,10 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr
Keep them consistent

diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 48737366f..fe1a87ba5 100644
index 3004270455..eb99f3a967 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -692,7 +692,7 @@ public class WorldServer extends World {
@@ -696,7 +696,7 @@ public class WorldServer extends World {
public void chunkCheck(Entity entity) {
this.getMethodProfiler().enter("chunkCheck");
int i = MathHelper.floor(entity.locX() / 16.0D);
Expand All @@ -21,5 +21,5 @@ index 48737366f..fe1a87ba5 100644

if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {
--
2.25.0.windows.1
2.25.2

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From c2f678b34e344f93581410c541b1558987a4eb1e Mon Sep 17 00:00:00 2001
From 671179f55b30b76b799ab240cf8f146e57be50a5 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Tue, 15 Aug 2017 22:29:12 -0400
Subject: [PATCH] Expand World.spawnParticle API and add Builder
Expand All @@ -10,7 +10,7 @@ Adds an option to control the force mode of the particle.
This adds a new Builder API which is much friendlier to use.

diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index bcb1c924b..c773314cf 100644
index eb99f3a967..da391e945c 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -56,7 +56,7 @@ public class WorldServer extends World {
Expand All @@ -22,7 +22,7 @@ index bcb1c924b..c773314cf 100644
boolean tickingEntities;
private final MinecraftServer server;
private final WorldNBTStorage dataManager;
@@ -1402,12 +1402,17 @@ public class WorldServer extends World {
@@ -1406,12 +1406,17 @@ public class WorldServer extends World {
}

public <T extends ParticleParam> int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
Expand All @@ -43,7 +43,7 @@ index bcb1c924b..c773314cf 100644

if (this.a(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 8e1057cdc..367da203a 100644
index 8e1057cdca..367da203ac 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2281,11 +2281,17 @@ public class CraftWorld implements World {
Expand All @@ -66,5 +66,5 @@ index 8e1057cdc..367da203a 100644
x, y, z, // Position
count, // Count
--
2.25.0
2.25.2

Loading

0 comments on commit 49fdb18

Please sign in to comment.