Manually inline PooledBlockPosition#d(int, int, int)
This commit is contained in:
parent
5fc45f4db0
commit
1d1c0561f2
|
@ -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.
|
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.
|
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
|
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||||
index 7b05bb9edcd059a134cef12cc9fea570217bc601..a0450a7ddf21659c5636b3f298e6bf4f0a93fc4d 100644
|
index 7b05bb9edcd059a134cef12cc9fea570217bc601..a0450a7ddf21659c5636b3f298e6bf4f0a93fc4d 100644
|
||||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||||
|
@ -140,7 +143,7 @@ index 7b05bb9edcd059a134cef12cc9fea570217bc601..a0450a7ddf21659c5636b3f298e6bf4f
|
||||||
return (int) (f + f1 + f2);
|
return (int) (f + f1 + f2);
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
index f8ac39e1b019b0918996f745d99f6ed09db0fd11..ec0e8f970dba64561afd6477a5df2821d9a8889a 100644
|
index f8ac39e1b019b0918996f745d99f6ed09db0fd11..9e523157f9daf8930afd96ab8701e500eb078f42 100644
|
||||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
@@ -99,6 +99,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
@@ -99,6 +99,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||||
|
@ -160,7 +163,22 @@ index f8ac39e1b019b0918996f745d99f6ed09db0fd11..ec0e8f970dba64561afd6477a5df2821
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPosition a(double d0, double d1, double d2) {
|
public BlockPosition a(double d0, double d1, double d2) {
|
||||||
@@ -343,11 +344,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
@@ -298,7 +299,13 @@ 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
|
||||||
|
@@ -343,11 +350,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MutableBlockPosition extends BlockPosition {
|
public static class MutableBlockPosition extends BlockPosition {
|
||||||
|
@ -176,7 +194,7 @@ index f8ac39e1b019b0918996f745d99f6ed09db0fd11..ec0e8f970dba64561afd6477a5df2821
|
||||||
public MutableBlockPosition() {
|
public MutableBlockPosition() {
|
||||||
this(0, 0, 0);
|
this(0, 0, 0);
|
||||||
}
|
}
|
||||||
@@ -357,10 +360,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
@@ -357,10 +366,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutableBlockPosition(int i, int j, int k) {
|
public MutableBlockPosition(int i, int j, int k) {
|
||||||
|
@ -192,7 +210,7 @@ index f8ac39e1b019b0918996f745d99f6ed09db0fd11..ec0e8f970dba64561afd6477a5df2821
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutableBlockPosition(double d0, double d1, double d2) {
|
public MutableBlockPosition(double d0, double d1, double d2) {
|
||||||
@@ -391,6 +397,9 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
@@ -391,6 +403,9 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||||
return super.a(enumblockrotation).immutableCopy();
|
return super.a(enumblockrotation).immutableCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +220,7 @@ index f8ac39e1b019b0918996f745d99f6ed09db0fd11..ec0e8f970dba64561afd6477a5df2821
|
||||||
@Override
|
@Override
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return this.b;
|
return this.b;
|
||||||
@@ -404,13 +413,16 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
@@ -404,13 +419,16 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||||
@Override
|
@Override
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return this.d;
|
return this.d;
|
||||||
|
@ -223,7 +241,7 @@ index f8ac39e1b019b0918996f745d99f6ed09db0fd11..ec0e8f970dba64561afd6477a5df2821
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,26 +452,26 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
@@ -440,26 +458,26 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) {
|
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) {
|
||||||
|
|
|
@ -99,10 +99,10 @@ index 6d351f0979ecfa8e500edf8dd03b4a455fd5d180..a44f65f40d2080b63069602a454266ee
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
index a3a376e35eaf17b128048bd26a22eef713e7d535..3fcfe416d26808fa1c9bfdc5b413b149764c544a 100644
|
index 8a3435a0accd68982fab497f25557edb5fdf56b4..9fc34246a845168d158a6b2793d8e344f2d2b008 100644
|
||||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
@@ -452,6 +452,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
@@ -458,6 +458,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||||
return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
|
return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ index 321eae23c575528788b1b575f17593580d6ba737..b19bbbbc81376177751396a2de9452ce
|
||||||
|
|
||||||
public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER
|
public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER
|
||||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||||
index dab9d36dfcda6f363fb78ad6be6a0306786945ae..6f7da0a79bbbb2be354796033baa498845aaea7c 100644
|
index adacff593ee20804b5ddb2df55b66bc6c162dc70..a52d8a27cee6721c32444d9d2bd81135b7d4b859 100644
|
||||||
--- a/src/main/java/net/minecraft/server/World.java
|
--- a/src/main/java/net/minecraft/server/World.java
|
||||||
+++ b/src/main/java/net/minecraft/server/World.java
|
+++ b/src/main/java/net/minecraft/server/World.java
|
||||||
@@ -1564,10 +1564,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
@@ -1564,10 +1564,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||||
|
@ -363,7 +363,7 @@ index dab9d36dfcda6f363fb78ad6be6a0306786945ae..6f7da0a79bbbb2be354796033baa4988
|
||||||
|
|
||||||
public boolean isSavingDisabled() {
|
public boolean isSavingDisabled() {
|
||||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
index 1f28e24f4f056c1f72293a3004c6dbdb8f8d1f9e..5519fb529dd8e1f93aab79dbc434715e08edb94f 100644
|
index f32e313a6287c8f5d487d4ad7148cac176773228..7fded15f14a3f5c04a676e9e25413718b9922c13 100644
|
||||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
@@ -531,7 +531,12 @@ public class WorldServer extends World {
|
@@ -531,7 +531,12 @@ public class WorldServer extends World {
|
||||||
|
|
Loading…
Reference in New Issue