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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user