Manually inline PooledBlockPosition#d(int, int, int)

This commit is contained in:
Andrew Steinborn 2020-06-27 10:56:32 -04:00
parent 8ed5bbea20
commit f884a07f57

View File

@ -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 {