2019-06-14 04:27:40 +02:00
|
|
|
From fe0cfb0c3d84367a65cc2282c8ed790440752c85 Mon Sep 17 00:00:00 2001
|
2018-07-15 03:53:17 +02:00
|
|
|
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
|
2019-06-06 17:36:57 +02:00
|
|
|
index 79a240cd1d..f224043d8e 100644
|
2018-07-15 03:53:17 +02:00
|
|
|
--- 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 {
|
2019-04-27 05:05:36 +02:00
|
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
2018-07-15 03:53:17 +02:00
|
|
|
private static final Map<Class<? extends Entity>, Integer> b = Maps.newHashMap();
|
|
|
|
private final Entity c;
|
|
|
|
- private final Map<Integer, DataWatcher.Item<?>> d = Maps.newHashMap();
|
2019-05-14 05:37:18 +02:00
|
|
|
+ private final Int2ObjectOpenHashMap<DataWatcher.Item<?>> d = new Int2ObjectOpenHashMap<>(); // Paper
|
2018-07-15 03:53:17 +02:00
|
|
|
private final ReadWriteLock e = new ReentrantReadWriteLock();
|
|
|
|
private boolean f = true;
|
|
|
|
private boolean g;
|
|
|
|
--
|
2019-04-23 06:47:07 +02:00
|
|
|
2.21.0
|
2018-07-15 03:53:17 +02:00
|
|
|
|