Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
70ce6ce831
This makes it easier for downstream projects (forks) to replace the version fetching system with their own. It is as simple as implementing an interface and overriding the default implementation of org.bukkit.UnsafeValues#getVersionFetcher() It also makes it easier for us to organize things like the version history feature. Lastly I have updated the paper implementation to check against the site API rather than against jenkins.
39 Zeilen
1.7 KiB
Diff
39 Zeilen
1.7 KiB
Diff
From 84528f3c4f2ba7346c3a5066dea2c584a92bd51c Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 26 Aug 2018 20:49:50 -0400
|
|
Subject: [PATCH] Optimize RegistryMaterials
|
|
|
|
Use larger initial sizes to increase bucket capacity on the BiMap
|
|
|
|
BiMap.get was seen to be using a good bit of CPU time.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java
|
|
index f291e05b2..fed38e6ef 100644
|
|
--- a/src/main/java/net/minecraft/server/RegistryMaterials.java
|
|
+++ b/src/main/java/net/minecraft/server/RegistryMaterials.java
|
|
@@ -16,9 +16,9 @@ import org.apache.logging.log4j.Logger;
|
|
public class RegistryMaterials<T> extends IRegistryWritable<T> {
|
|
|
|
protected static final Logger LOGGER = LogManager.getLogger();
|
|
- protected final RegistryID<T> b = new RegistryID<>(256);
|
|
- protected final BiMap<MinecraftKey, T> c = HashBiMap.create();
|
|
- protected Object[] d;
|
|
+ protected final RegistryID<T> b = new RegistryID<>(2048); // Paper - use bigger expected size to reduce collisions
|
|
+ protected final BiMap<MinecraftKey, T> c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions
|
|
+ protected T[] d; // Paper - Decompile fix
|
|
private int R;
|
|
|
|
public RegistryMaterials() {}
|
|
@@ -98,7 +98,7 @@ public class RegistryMaterials<T> extends IRegistryWritable<T> {
|
|
return null;
|
|
}
|
|
|
|
- this.d = collection.toArray(new Object[collection.size()]);
|
|
+ this.d = (T[]) collection.toArray(new Object[collection.size()]); // Paper - Decompile fix
|
|
}
|
|
|
|
return this.d[random.nextInt(this.d.length)];
|
|
--
|
|
2.21.0
|
|
|