Paper/Spigot-Server-Patches/0088-Use-Optimized-Collections.patch
Aikar b62dfa0bf9
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers

CraftBukkit Changes:
1cf8b5dc SPIGOT-4400: Populators running on existing chunks
116cb9a1 SPIGOT-4399: Add attribute modifier equality test
5ee1c18a SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
2018-09-28 19:31:59 -04:00

39 lines
1.8 KiB
Diff

From 1ab2476a22758ca4105962280dde11b9464b8966 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 30 Mar 2016 02:13:24 -0400
Subject: [PATCH] Use Optimized Collections
Swap out CraftBukkit LongObjectHashMap with Long2ObjectOpenHashMap
Swap out Integer key HashMap for a Int2ObjectOpenHashMap For ChunkProviderServer
Amaranth, the creator of LongObjectHashMap, tested it vs fastutil and determined fastutil to be 3x faster
and could not create anything faster than fastutil.
These collections are super fast as seen
http://java-performance.info/hashmap-overview-jdk-fastutil-goldman-sachs-hppc-koloboke-trove-january-2015/
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
index 2b27ae7973..7191185ba7 100644
--- a/src/main/java/net/minecraft/server/DataWatcher.java
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
@@ -12,6 +12,7 @@ import java.util.Map;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.annotation.Nullable;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper
import org.apache.commons.lang3.ObjectUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -21,7 +22,7 @@ public class DataWatcher {
private static final Logger a = LogManager.getLogger();
private static final Map<Class<? extends Entity>, Integer> b = Maps.newHashMap();
private final Entity c;
- private final Map<Integer, DataWatcher.Item<?>> d = Maps.newHashMap();
+ private final Map<Integer, DataWatcher.Item<?>> d = new Int2ObjectOpenHashMap<>(); // Paper
private final ReadWriteLock e = new ReentrantReadWriteLock();
private boolean f = true;
private boolean g;
--
2.19.0