Commits

Thinkofname authored ee6d0fa9384
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
No tags

nms-patches/EntitySlice.patch

Added
1 +--- ../work/decompile-8eb82bde/net/minecraft/server/EntitySlice.java 2015-02-20 10:18:42.025023871 +0000
2 ++++ src/main/java/net/minecraft/server/EntitySlice.java 2015-02-20 10:18:42.057023871 +0000
3 +@@ -4,6 +4,7 @@
4 + import com.google.common.collect.Multimap;
5 + import com.google.common.collect.Sets;
6 + import java.util.AbstractSet;
7 ++import java.util.Collections;
8 + import java.util.Iterator;
9 + import java.util.Set;
10 + import org.apache.commons.lang3.ClassUtils;
11 +@@ -89,6 +90,11 @@
12 + }
13 +
14 + public Iterator iterator() {
15 ++ // CraftBukkit start
16 ++ if (!this.a.containsKey(this.c)) {
17 ++ return Collections.EMPTY_LIST.iterator();
18 ++ }
19 ++ // CraftBukkit end
20 + Iterator iterator = this.a.get(this.c).iterator();
21 +
22 + return new EntitySliceInnerClass2(this, iterator);

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut