diff --git a/Spigot-Server-Patches/Improve-BlockPosition-inlining.patch b/Spigot-Server-Patches/Improve-BlockPosition-inlining.patch index 58706a92f..00d56ebdc 100644 --- a/Spigot-Server-Patches/Improve-BlockPosition-inlining.patch +++ b/Spigot-Server-Patches/Improve-BlockPosition-inlining.patch @@ -20,6 +20,9 @@ This should result in an across the board speedup in anything that accesses bloc This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks. They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. +In addition, manually inline PooledBlockPosition#d(int, int, int) as it is a hot method that doesn't get inlined due to +invokespecial instructions. + diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java @@ -161,6 +164,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public BlockPosition a(double d0, double d1, double d2) { @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali + + @Override + public BlockPosition.PooledBlockPosition d(int i, int j, int k) { +- return (BlockPosition.PooledBlockPosition) super.d(i, j, k); ++ // Paper start - manually inline this hot method ++ //return (BlockPosition.PooledBlockPosition) super.d(i, j, k); ++ this.x = i; ++ this.y = j; ++ this.z = k; ++ return this; ++ // Paper end + } + + @Override +@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali } public static class MutableBlockPosition extends BlockPosition {