aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-API-Patches/0003-Timings-v2.patch
diff options
context:
space:
mode:
authorAikar <[email protected]>2016-03-30 01:59:47 -0400
committerAikar <[email protected]>2016-03-30 01:59:47 -0400
commit31a482e9f0e193be1ca9db43789210468af8343e (patch)
tree4c64a8182a9c2a60550a685c0efae6f83b7de3c0 /Spigot-API-Patches/0003-Timings-v2.patch
parentc2f872aed351ecceae51068c2f2e60218f733d00 (diff)
downloadPaper-31a482e9f0e193be1ca9db43789210468af8343e.tar.gz
Paper-31a482e9f0e193be1ca9db43789210468af8343e.zip
Move Timings v2 TimingHandler to FastUtil Int map
Diffstat (limited to 'Spigot-API-Patches/0003-Timings-v2.patch')
-rw-r--r--Spigot-API-Patches/0003-Timings-v2.patch46
1 files changed, 25 insertions, 21 deletions
diff --git a/Spigot-API-Patches/0003-Timings-v2.patch b/Spigot-API-Patches/0003-Timings-v2.patch
index 949960d9c4..941ed56604 100644
--- a/Spigot-API-Patches/0003-Timings-v2.patch
+++ b/Spigot-API-Patches/0003-Timings-v2.patch
@@ -1,4 +1,4 @@
-From e3d0784acb044ea7d704eae393c66e586edd6dcc Mon Sep 17 00:00:00 2001
+From c06ec1a9abc604b79f3c0e282ca752814de91110 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Mon, 29 Feb 2016 18:48:17 -0600
Subject: [PATCH] Timings v2
@@ -457,10 +457,10 @@ index 0000000..b62e428
+}
diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java
new file mode 100644
-index 0000000..4918a17
+index 0000000..46c4e13
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHandler.java
-@@ -0,0 +1,193 @@
+@@ -0,0 +1,190 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@@ -486,13 +486,10 @@ index 0000000..4918a17
+ */
+package co.aikar.timings;
+
-+import gnu.trove.map.hash.TIntObjectHashMap;
-+import org.bukkit.Bukkit;
+import co.aikar.util.LoadingIntMap;
-+import co.aikar.util.LoadingMap;
-+import co.aikar.util.MRUMapCache;
++import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
++import org.bukkit.Bukkit;
+
-+import java.util.Map;
+import java.util.logging.Level;
+
+class TimingHandler implements Timing {
@@ -503,7 +500,7 @@ index 0000000..4918a17
+ final String name;
+ final boolean verbose;
+
-+ final TIntObjectHashMap<TimingData> children = new LoadingIntMap<TimingData>(TimingData.LOADER);
++ final Int2ObjectOpenHashMap<TimingData> children = new LoadingIntMap<>(TimingData.LOADER);
+
+ final TimingData record;
+ final TimingHandler groupHandler;
@@ -543,7 +540,7 @@ index 0000000..4918a17
+ }
+
+ record.processTick(violated);
-+ for (TimingData handler : children.valueCollection()) {
++ for (TimingData handler : children.values()) {
+ handler.processTick(violated);
+ }
+ }
@@ -938,7 +935,7 @@ index 0000000..7a04770
+}
diff --git a/src/main/java/co/aikar/timings/TimingHistoryEntry.java b/src/main/java/co/aikar/timings/TimingHistoryEntry.java
new file mode 100644
-index 0000000..eac4e21
+index 0000000..a5c5dfd
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHistoryEntry.java
@@ -0,0 +1,59 @@
@@ -981,7 +978,7 @@ index 0000000..eac4e21
+ this.data = handler.record.clone();
+ children = new TimingData[handler.children.size()];
+ int i = 0;
-+ for (TimingData child : handler.children.valueCollection()) {
++ for (TimingData child : handler.children.values()) {
+ children[i++] = child.clone();
+ }
+ }
@@ -2271,10 +2268,10 @@ index 0000000..5fdf7c4
+}
diff --git a/src/main/java/co/aikar/util/LoadingIntMap.java b/src/main/java/co/aikar/util/LoadingIntMap.java
new file mode 100644
-index 0000000..8d0f269
+index 0000000..79fa9d5
--- /dev/null
+++ b/src/main/java/co/aikar/util/LoadingIntMap.java
-@@ -0,0 +1,63 @@
+@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015. Starlis LLC / dba Empire Minecraft
+ *
@@ -2285,7 +2282,7 @@ index 0000000..8d0f269
+
+
+import com.google.common.base.Function;
-+import gnu.trove.map.hash.TIntObjectHashMap;
++import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+
+/**
+ * Allows you to pass a Loader function that when a key is accessed that doesn't exist,
@@ -2301,14 +2298,21 @@ index 0000000..8d0f269
+ *
+ * @param <V> Value
+ */
-+public class LoadingIntMap<V> extends TIntObjectHashMap<V> {
++public class LoadingIntMap<V> extends Int2ObjectOpenHashMap<V> {
+ private final Function<Integer, V> loader;
+
-+ /**
-+ * Initializes an auto loading map using specified loader and backing map
-+ * @param loader The loader
-+ */
+ public LoadingIntMap(Function<Integer, V> loader) {
++ super();
++ this.loader = loader;
++ }
++
++ public LoadingIntMap(int expectedSize, Function<Integer, V> loader) {
++ super(expectedSize);
++ this.loader = loader;
++ }
++
++ public LoadingIntMap(int expectedSize, float loadFactor, Function<Integer, V> loader) {
++ super(expectedSize, loadFactor);
+ this.loader = loader;
+ }
+
@@ -3538,5 +3542,5 @@ index 8d98297..7e89b97 100644
- }
}
--
-2.7.4
+2.8.0