From 48ee598798594a6ded02156ca0e14f3f9fefbcd4 Mon Sep 17 00:00:00 2001 From: Etil <81570777+etil2jz@users.noreply.github.com> Date: Tue, 21 Sep 2021 17:45:33 +0200 Subject: [PATCH] (Lithium) Reduce allocations --- .../0039-Lithium-Reduce-allocations.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 patches/server/0039-Lithium-Reduce-allocations.patch diff --git a/patches/server/0039-Lithium-Reduce-allocations.patch b/patches/server/0039-Lithium-Reduce-allocations.patch new file mode 100644 index 0000000..ec21d22 --- /dev/null +++ b/patches/server/0039-Lithium-Reduce-allocations.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Etil <81570777+etil2jz@users.noreply.github.com> +Date: Tue, 21 Sep 2021 17:44:35 +0200 +Subject: [PATCH] (Lithium) Reduce allocations + + +diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +index 4c9ae6bdb2f0358798f84928271a2d783dcba7b4..9ff643b8c7d4eae59594da1eb5ed9aae815fa9be 100644 +--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +@@ -374,7 +374,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { + + @Override + public int[] getSlotsForFace(Direction side) { +- return side == Direction.DOWN ? new int[]{0} : new int[0]; ++ return side == Direction.DOWN ? xyz.arthurb.mirai.server.util.Constants.ZERO_ARRAY : xyz.arthurb.mirai.server.util.Constants.ZERO_ARRAY; // Yatopia - avoid array allocation + } + + @Override +@@ -423,7 +423,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { + + @Override + public int[] getSlotsForFace(Direction side) { +- return side == Direction.UP ? new int[]{0} : new int[0]; ++ return side == Direction.UP ? xyz.arthurb.mirai.server.util.Constants.ZERO_ARRAY : xyz.arthurb.mirai.server.util.Constants.ZERO_ARRAY; // Yatopia - avoid array allocation + } + + @Override +@@ -460,7 +460,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { + + @Override + public int[] getSlotsForFace(Direction side) { +- return new int[0]; ++ return xyz.arthurb.mirai.server.util.Constants.EMPTY_ARRAY; // Yatopia - avoid array allocation + } + + @Override