2017-07-27 06:25:13 +02:00
|
|
|
From 92c11ac4d9226bc25c8f4b82fbf686c30b8c4660 Mon Sep 17 00:00:00 2001
|
2016-04-06 02:43:11 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Wed, 30 Mar 2016 02:13:24 -0400
|
2016-04-06 03:55:07 +02:00
|
|
|
Subject: [PATCH] Use Optimized Collections
|
|
|
|
|
|
|
|
Swap out CraftBukkit LongObjectHashMap with Long2ObjectOpenHashMap
|
|
|
|
Swap out Integer key HashMap for a Int2ObjectOpenHashMap For ChunkProviderServer
|
2016-04-06 02:43:11 +02:00
|
|
|
|
|
|
|
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
|
2017-07-27 06:25:13 +02:00
|
|
|
index 1507f97fd..fe8484453 100644
|
2016-04-06 02:43:11 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/DataWatcher.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
|
2016-06-25 19:19:04 +02:00
|
|
|
@@ -12,6 +12,7 @@ import java.util.Map;
|
2016-04-06 02:43:11 +02:00
|
|
|
import java.util.concurrent.locks.ReadWriteLock;
|
|
|
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
2016-05-12 04:07:46 +02:00
|
|
|
import javax.annotation.Nullable;
|
2016-04-06 02:43:11 +02:00
|
|
|
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
2016-06-25 19:19:04 +02:00
|
|
|
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;
|
2016-04-06 02:43:11 +02:00
|
|
|
--
|
2017-07-27 06:25:13 +02:00
|
|
|
2.13.0
|
2016-04-06 02:43:11 +02:00
|
|
|
|