diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2015-02-20 10:19:11 +0000 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2015-02-20 10:19:11 +0000 |
commit | ee6d0fa9384fba4be2efe5ea2a0e06ba7df8df11 (patch) | |
tree | 9c6c6970c7c0496e895a93e9a2823d1d03ce47f8 | |
parent | 1d63ff0d9b6a3904d10e673c440a77b9c5424db3 (diff) | |
download | craftbukkit-ee6d0fa9384fba4be2efe5ea2a0e06ba7df8df11.tar craftbukkit-ee6d0fa9384fba4be2efe5ea2a0e06ba7df8df11.tar.gz craftbukkit-ee6d0fa9384fba4be2efe5ea2a0e06ba7df8df11.tar.lz craftbukkit-ee6d0fa9384fba4be2efe5ea2a0e06ba7df8df11.tar.xz craftbukkit-ee6d0fa9384fba4be2efe5ea2a0e06ba7df8df11.zip |
SPIGOT-591: Optimize EntitySlice.iterator
Previously if the key 'this.c' was missing a new hashmap was created, this
caused thousands to be created each tick
-rw-r--r-- | nms-patches/EntitySlice.patch | 22 | ||||
-rw-r--r-- | nms-patches/EntitySliceInnerClass1.patch | 10 | ||||
-rw-r--r-- | nms-patches/EntitySliceInnerClass2.patch | 10 |
3 files changed, 42 insertions, 0 deletions
diff --git a/nms-patches/EntitySlice.patch b/nms-patches/EntitySlice.patch new file mode 100644 index 00000000..5e898280 --- /dev/null +++ b/nms-patches/EntitySlice.patch @@ -0,0 +1,22 @@ +--- ../work/decompile-8eb82bde/net/minecraft/server/EntitySlice.java 2015-02-20 10:18:42.025023871 +0000 ++++ src/main/java/net/minecraft/server/EntitySlice.java 2015-02-20 10:18:42.057023871 +0000 +@@ -4,6 +4,7 @@ + import com.google.common.collect.Multimap; + import com.google.common.collect.Sets; + import java.util.AbstractSet; ++import java.util.Collections; + import java.util.Iterator; + import java.util.Set; + import org.apache.commons.lang3.ClassUtils; +@@ -89,6 +90,11 @@ + } + + public Iterator iterator() { ++ // CraftBukkit start ++ if (!this.a.containsKey(this.c)) { ++ return Collections.EMPTY_LIST.iterator(); ++ } ++ // CraftBukkit end + Iterator iterator = this.a.get(this.c).iterator(); + + return new EntitySliceInnerClass2(this, iterator); diff --git a/nms-patches/EntitySliceInnerClass1.patch b/nms-patches/EntitySliceInnerClass1.patch new file mode 100644 index 00000000..c4cf2192 --- /dev/null +++ b/nms-patches/EntitySliceInnerClass1.patch @@ -0,0 +1,10 @@ +--- ../work/decompile-8eb82bde/net/minecraft/server/EntitySliceInnerClass1.java 2015-02-20 10:18:41.853023875 +0000 ++++ src/main/java/net/minecraft/server/EntitySliceInnerClass1.java 2015-02-20 10:18:41.853023875 +0000 +@@ -3,6 +3,7 @@ + import com.google.common.collect.Iterators; + import java.util.Iterator; + ++// PAIL: Access transform + class EntitySliceInnerClass1 implements Iterable { + + final Class a; diff --git a/nms-patches/EntitySliceInnerClass2.patch b/nms-patches/EntitySliceInnerClass2.patch new file mode 100644 index 00000000..bd7f1184 --- /dev/null +++ b/nms-patches/EntitySliceInnerClass2.patch @@ -0,0 +1,10 @@ +--- ../work/decompile-8eb82bde/net/minecraft/server/EntitySliceInnerClass2.java 2015-02-20 10:18:41.945023873 +0000 ++++ src/main/java/net/minecraft/server/EntitySliceInnerClass2.java 2015-02-20 10:18:41.965023873 +0000 +@@ -3,6 +3,7 @@ + import com.google.common.collect.AbstractIterator; + import java.util.Iterator; + ++// PAIL: Access transform + class EntitySliceInnerClass2 extends AbstractIterator { + + final Iterator a; |