From e9937293f8abde484a59cf20bebbd786bfede75a Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 28 Aug 2018 21:36:42 -0400 Subject: [PATCH] Optimize Chunk#getPos get rid of object creation --- .../Optimize-Chunk-getPos.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Spigot-Server-Patches/Optimize-Chunk-getPos.patch diff --git a/Spigot-Server-Patches/Optimize-Chunk-getPos.patch b/Spigot-Server-Patches/Optimize-Chunk-getPos.patch new file mode 100644 index 0000000000..cedb4593bb --- /dev/null +++ b/Spigot-Server-Patches/Optimize-Chunk-getPos.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Tue, 28 Aug 2018 21:35:05 -0400 +Subject: [PATCH] Optimize Chunk#getPos + +Don't create an object just to get chunk coords. + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index f3d9211baa..ed6d0dce33 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + // CraftBukkit start + this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this); + this.chunkKey = ChunkCoordIntPair.a(this.locX, this.locZ); ++ this.chunkCoords = new ChunkCoordIntPair(this.locX, this.locZ); // Paper + } +- ++ private final ChunkCoordIntPair chunkCoords; // Paper + public org.bukkit.Chunk bukkitChunk; + public boolean mustSave; + public boolean newChunk; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + } + + public ChunkCoordIntPair getPos() { +- return new ChunkCoordIntPair(this.locX, this.locZ); ++ return this.chunkCoords; // Paper + } + + public boolean b(int i, int j) { +-- \ No newline at end of file