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
Dieser Commit ist enthalten in:
Ursprung
1d63ff0d9b
Commit
ee6d0fa938
22
nms-patches/EntitySlice.patch
Normale Datei
22
nms-patches/EntitySlice.patch
Normale Datei
@ -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);
|
10
nms-patches/EntitySliceInnerClass1.patch
Normale Datei
10
nms-patches/EntitySliceInnerClass1.patch
Normale Datei
@ -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;
|
10
nms-patches/EntitySliceInnerClass2.patch
Normale Datei
10
nms-patches/EntitySliceInnerClass2.patch
Normale Datei
@ -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;
|
In neuem Issue referenzieren
Einen Benutzer sperren