9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-22 16:29:26 +00:00

Move empty ServerLevel array to reduce allocations patch

This commit is contained in:
Martijn Muijsers
2023-01-29 22:13:18 +01:00
parent 946f567282
commit c99c917d7e
2 changed files with 5 additions and 22 deletions

View File

@@ -133,14 +133,16 @@ index f597d65d56964297eeeed6c7e77703764178fee0..d503c0a7c4706af28a7db2face5efd8d
this.storage = Arrays.copyOf(this.storage, this.storage.length * 2); this.storage = Arrays.copyOf(this.storage, this.storage.length * 2);
diff --git a/src/main/java/me/titaniumtown/ArrayConstants.java b/src/main/java/me/titaniumtown/ArrayConstants.java diff --git a/src/main/java/me/titaniumtown/ArrayConstants.java b/src/main/java/me/titaniumtown/ArrayConstants.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..ceec23a85aae625fbbe2db95c8e9c83fb9f9767c index 0000000000000000000000000000000000000000..c99e9e361ab4377c0df76b943b96bf87e138d91c
--- /dev/null --- /dev/null
+++ b/src/main/java/me/titaniumtown/ArrayConstants.java +++ b/src/main/java/me/titaniumtown/ArrayConstants.java
@@ -0,0 +1,18 @@ @@ -0,0 +1,21 @@
+// Gale - JettPack - reduce array allocations +// Gale - JettPack - reduce array allocations
+ +
+package me.titaniumtown; +package me.titaniumtown;
+ +
+import net.minecraft.server.level.ServerLevel;
+
+public final class ArrayConstants { +public final class ArrayConstants {
+ +
+ private ArrayConstants() {} + private ArrayConstants() {}
@@ -153,6 +155,7 @@ index 0000000000000000000000000000000000000000..ceec23a85aae625fbbe2db95c8e9c83f
+ public static final long[] emptyLongArray = new long[0]; + public static final long[] emptyLongArray = new long[0];
+ public static final org.bukkit.entity.Entity[] emptyBukkitEntityArray = new org.bukkit.entity.Entity[0]; + public static final org.bukkit.entity.Entity[] emptyBukkitEntityArray = new org.bukkit.entity.Entity[0];
+ public static final net.minecraft.world.entity.Entity[] emptyEntityArray = new net.minecraft.world.entity.Entity[0]; + public static final net.minecraft.world.entity.Entity[] emptyEntityArray = new net.minecraft.world.entity.Entity[0];
+ public static final ServerLevel[] emptyServerLevelArray = new ServerLevel[0];
+ +
+} +}
diff --git a/src/main/java/net/minecraft/advancements/RequirementsStrategy.java b/src/main/java/net/minecraft/advancements/RequirementsStrategy.java diff --git a/src/main/java/net/minecraft/advancements/RequirementsStrategy.java b/src/main/java/net/minecraft/advancements/RequirementsStrategy.java

View File

@@ -630,26 +630,6 @@ index 95cac7edae8ac64811fc6a2f6b97dd4a0fceb0b0..a376259202b4a16c67db4d3ef071e0b3
this.dataFixer = dataFixer; this.dataFixer = dataFixer;
this.generatorKey = generatorKey; this.generatorKey = generatorKey;
this.removeCaches = removeCaches; this.removeCaches = removeCaches;
diff --git a/src/main/java/me/titaniumtown/ArrayConstants.java b/src/main/java/me/titaniumtown/ArrayConstants.java
index ceec23a85aae625fbbe2db95c8e9c83fb9f9767c..fdb9eefdcbd4abf1936761136077c3d10ef5e594 100644
--- a/src/main/java/me/titaniumtown/ArrayConstants.java
+++ b/src/main/java/me/titaniumtown/ArrayConstants.java
@@ -2,6 +2,8 @@
package me.titaniumtown;
+import net.minecraft.server.level.ServerLevel;
+
public final class ArrayConstants {
private ArrayConstants() {}
@@ -14,5 +16,6 @@ public final class ArrayConstants {
public static final long[] emptyLongArray = new long[0];
public static final org.bukkit.entity.Entity[] emptyBukkitEntityArray = new org.bukkit.entity.Entity[0];
public static final net.minecraft.world.entity.Entity[] emptyEntityArray = new net.minecraft.world.entity.Entity[0];
+ public static final ServerLevel[] emptyServerLevelArray = new ServerLevel[0]; // Gale - base thread pool
}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 5ef58831a857fd8aa4ac30147762dc17d773a53e..6b109d92dec227d4a91a455caf596beb112a8351 100644 index 5ef58831a857fd8aa4ac30147762dc17d773a53e..6b109d92dec227d4a91a455caf596beb112a8351 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java