summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-08-19 19:59:58 -0500
committerTravis Watkins <amaranth@ubuntu.com>2012-08-20 18:44:07 -0500
commitccc760d629e657e3b349ac9ea7abd890b4592106 (patch)
tree69c6044550ab65eda50e0b7471acf30da1298990 /src/main/java/net/minecraft
parente7e643d83a137107727d2120e51a2ee3ad571d1a (diff)
downloadcraftbukkit-ccc760d629e657e3b349ac9ea7abd890b4592106.tar
craftbukkit-ccc760d629e657e3b349ac9ea7abd890b4592106.tar.gz
craftbukkit-ccc760d629e657e3b349ac9ea7abd890b4592106.tar.lz
craftbukkit-ccc760d629e657e3b349ac9ea7abd890b4592106.tar.xz
craftbukkit-ccc760d629e657e3b349ac9ea7abd890b4592106.zip
Use a dynamic pool size for the iterator cache
Many codepaths only end up with one iterator being used at a time and most of the rest only get up to two being used so using a static pool of three is wasteful. This also allows us to efficiently handle cases that exceed 3 iterators in use. Overall this dramatically increases the hit rate and results in less iterators being created.
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalSelector.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index 02f6e46b..38f53522 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -111,11 +111,13 @@ public class PathfinderGoalSelector {
// CraftBukkit - switch order
if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.b.contains(pathfindergoalselectoritem1)) {
// this.c.b(); // CraftBukkit - not in production code
+ ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
return false;
}
// CraftBukkit - switch order
} else if (!pathfindergoalselectoritem1.a.g() && this.b.contains(pathfindergoalselectoritem1)) {
// this.c.b(); // CraftBukkit - not in production code
+ ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
return false;
}
}