2016-06-09 03:57:14 +00:00
|
|
|
From fcbbb13b4fb8142f1d320bc5ddf3533a6afd134e Mon Sep 17 00:00:00 2001
|
2016-04-06 00:43:11 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Wed, 30 Mar 2016 02:13:24 -0400
|
2016-04-06 01:55:07 +00: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 00:43:11 +00: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/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
2016-06-09 03:57:14 +00:00
|
|
|
index 1fd844b..f8905b4 100644
|
2016-04-06 00:43:11 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
2016-05-12 02:07:46 +00:00
|
|
|
@@ -24,7 +24,7 @@ import org.bukkit.event.world.ChunkUnloadEvent;
|
|
|
|
public class ChunkProviderServer implements IChunkProvider {
|
2016-04-06 00:43:11 +00:00
|
|
|
|
2016-05-12 02:07:46 +00:00
|
|
|
private static final Logger a = LogManager.getLogger();
|
2016-06-09 03:57:14 +00:00
|
|
|
- public final Set<Long> unloadQueue = Sets.newHashSet();
|
2016-05-12 02:07:46 +00:00
|
|
|
+ public final it.unimi.dsi.fastutil.longs.LongSet unloadQueue = new it.unimi.dsi.fastutil.longs.LongArraySet(); // PAIL: private -> public // Paper
|
|
|
|
public final ChunkGenerator chunkGenerator;
|
2016-04-06 00:43:11 +00:00
|
|
|
private final IChunkLoader chunkLoader;
|
|
|
|
// Paper start
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
|
2016-05-12 02:07:46 +00:00
|
|
|
index ec77a5c..86ad41d 100644
|
2016-04-06 00:43:11 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/DataWatcher.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
|
2016-05-12 02:07:46 +00:00
|
|
|
@@ -12,13 +12,14 @@ import java.util.Map;
|
2016-04-06 00:43:11 +00:00
|
|
|
import java.util.concurrent.locks.ReadWriteLock;
|
|
|
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
2016-05-12 02:07:46 +00:00
|
|
|
import javax.annotation.Nullable;
|
2016-04-06 00:43:11 +00:00
|
|
|
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
|
|
|
public class DataWatcher {
|
|
|
|
|
|
|
|
private static final Map<Class<? extends Entity>, Integer> a = Maps.newHashMap();
|
|
|
|
private final Entity b;
|
|
|
|
- private final Map<Integer, DataWatcher.Item<?>> c = Maps.newHashMap();
|
|
|
|
+ private final Map<Integer, DataWatcher.Item<?>> c = new Int2ObjectOpenHashMap<>(); // Paper
|
|
|
|
private final ReadWriteLock d = new ReentrantReadWriteLock();
|
|
|
|
private boolean e = true;
|
|
|
|
private boolean f;
|
|
|
|
--
|
2016-06-09 03:57:14 +00:00
|
|
|
2.8.3
|
2016-04-06 00:43:11 +00:00
|
|
|
|