Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 04:50:05 +01:00
835bc39b03
Updated Upstream (Bukkit/CraftBukkit/Spigot) Bukkit Changes: 2dcc44dc SPIGOT-4307: Fix hacky API for banners on shields e0fc6572 SPIGOT-4309: Add "forced" display of particles efeeab2f Add index to README.md for easier navigation f502bc6f Update to Minecraft 1.13.1 CraftBukkit Changes:d0bb0a1d
Fix some tests randomly failing997d378d
Fix client stall in specific teleportation scenariosb3dc2366
SPIGOT-4307: Fix hacky API for banners on shields2a271162
SPIGOT-4301: Fix more invalid enchants5d0d83bb
SPIGOT-4309: Add "forced" display of particlesa6772578
Add additional tests for CraftBlockDatace1af0c3
Update to Minecraft 1.13.1 Spigot Changes: 2440e189 Rebuild patches 4ecffced Update to Minecraft 1.13.1
69 Zeilen
2.3 KiB
Diff
69 Zeilen
2.3 KiB
Diff
From fa670184f6b30408f73ebe46e89578a4bd2b68b4 Mon Sep 17 00:00:00 2001
|
|
From: Andrew Steinborn <git@steinborn.me>
|
|
Date: Mon, 23 Jul 2018 13:08:19 -0400
|
|
Subject: [PATCH] Optimize RegistryID.c()
|
|
|
|
This is a frequent hotspot for world loading/saving.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java
|
|
index bde5714dd6..a01cda9d81 100644
|
|
--- a/src/main/java/net/minecraft/server/RegistryID.java
|
|
+++ b/src/main/java/net/minecraft/server/RegistryID.java
|
|
@@ -14,12 +14,14 @@ public class RegistryID<K> implements Registry { // Paper - decompile fix
|
|
private K[] d;
|
|
private int e;
|
|
private int f;
|
|
+ private java.util.BitSet usedIds; // Paper
|
|
|
|
public RegistryID(int i) {
|
|
i = (int) ((float) i / 0.8F);
|
|
this.b = (K[]) (new Object[i]); // Paper - decompile fix
|
|
this.c = new int[i];
|
|
this.d = (K[]) (new Object[i]); // Paper - decompile fix
|
|
+ this.usedIds = new java.util.BitSet(); // Paper
|
|
}
|
|
|
|
public int getId(@Nullable K k0) {
|
|
@@ -43,9 +45,14 @@ public class RegistryID<K> implements Registry { // Paper - decompile fix
|
|
}
|
|
|
|
private int c() {
|
|
+ // Paper start
|
|
+ /*
|
|
while (this.e < this.d.length && this.d[this.e] != null) {
|
|
++this.e;
|
|
}
|
|
+ */
|
|
+ this.e = this.usedIds.nextClearBit(0);
|
|
+ // Paper end
|
|
|
|
return this.e;
|
|
}
|
|
@@ -59,6 +66,7 @@ public class RegistryID<K> implements Registry { // Paper - decompile fix
|
|
this.d = (K[]) (new Object[i]); // Paper - decompile fix
|
|
this.e = 0;
|
|
this.f = 0;
|
|
+ this.usedIds.clear(); // Paper
|
|
|
|
for (int j = 0; j < aobject.length; ++j) {
|
|
if (aobject[j] != null) {
|
|
@@ -84,6 +92,7 @@ public class RegistryID<K> implements Registry { // Paper - decompile fix
|
|
this.b[k] = k0;
|
|
this.c[k] = i;
|
|
this.d[i] = k0;
|
|
+ this.usedIds.set(i); // Paper
|
|
++this.f;
|
|
if (i == this.e) {
|
|
++this.e;
|
|
@@ -148,6 +157,7 @@ public class RegistryID<K> implements Registry { // Paper - decompile fix
|
|
Arrays.fill(this.d, (Object) null);
|
|
this.e = 0;
|
|
this.f = 0;
|
|
+ this.usedIds.clear(); // Paper
|
|
}
|
|
|
|
public int b() {
|
|
--
|
|
2.18.0
|
|
|