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.
This commit is contained in:
Travis Watkins
2012-08-17 12:55:33 -05:00
parent 6d777ade16
commit 858d36efc9
4 changed files with 120 additions and 20 deletions

View File

@@ -57,7 +57,7 @@ public class Chunk {
this.heightMap = new int[256];
for (int k = 0; k < this.entitySlices.length; ++k) {
this.entitySlices[k] = new ArrayList();
this.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
}
Arrays.fill(this.b, -999);