diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-08-17 12:55:33 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-08-19 09:50:57 -0500 |
commit | 858d36efc9045d952af21ca4c33ad2756a05f8ae (patch) | |
tree | 86bca5dcb13fbb61d73a513a6024461e1422a466 /src/main/java/net/minecraft/server/PathfinderGoalSelector.java | |
parent | 6d777ade166a5543a293c9353d7e6910b4a52b17 (diff) | |
download | craftbukkit-858d36efc9045d952af21ca4c33ad2756a05f8ae.tar craftbukkit-858d36efc9045d952af21ca4c33ad2756a05f8ae.tar.gz craftbukkit-858d36efc9045d952af21ca4c33ad2756a05f8ae.tar.lz craftbukkit-858d36efc9045d952af21ca4c33ad2756a05f8ae.tar.xz craftbukkit-858d36efc9045d952af21ca4c33ad2756a05f8ae.zip |
Add iterator cache to UnsafeList and use it in hotspots
Adds a specialized iterator for the list and a pool of iterators to avoid
object churn. Also optimizes the clear() method to reduce object creation.
Diffstat (limited to 'src/main/java/net/minecraft/server/PathfinderGoalSelector.java')
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalSelector.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java index dc16a625..9ef8ec76 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java @@ -4,10 +4,14 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import org.bukkit.craftbukkit.util.UnsafeList; // CraftBukkit + public class PathfinderGoalSelector { - private List a = new ArrayList(); - private List b = new ArrayList(); + // CraftBukkit start - ArrayList -> UnsafeList + private List a = new UnsafeList(); + private List b = new UnsafeList(); + // CraftBukkit end private final MethodProfiler c; private int d = 0; private int e = 3; @@ -21,7 +25,7 @@ public class PathfinderGoalSelector { } public void a() { - ArrayList arraylist = new ArrayList(); + UnsafeList arraylist = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList Iterator iterator; PathfinderGoalSelectorItem pathfindergoalselectoritem; |