count betterblockpos instantiation
This commit is contained in:
@@ -90,6 +90,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
HashMap<Class<? extends Movement>, Long> timeConsumed = new HashMap<>();
|
HashMap<Class<? extends Movement>, Long> timeConsumed = new HashMap<>();
|
||||||
HashMap<Class<? extends Movement>, Integer> count = new HashMap<>();
|
HashMap<Class<? extends Movement>, Integer> count = new HashMap<>();
|
||||||
HashMap<Class<? extends Movement>, Integer> stateLookup = new HashMap<>();
|
HashMap<Class<? extends Movement>, Integer> stateLookup = new HashMap<>();
|
||||||
|
HashMap<Class<? extends Movement>, Long> posCreation = new HashMap<>();
|
||||||
long heapRemove = 0;
|
long heapRemove = 0;
|
||||||
int heapRemoveCount = 0;
|
int heapRemoveCount = 0;
|
||||||
long heapAdd = 0;
|
long heapAdd = 0;
|
||||||
@@ -161,9 +162,11 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
chunkCount++;
|
chunkCount++;
|
||||||
// TODO cache cost
|
// TODO cache cost
|
||||||
int numLookupsBefore = BlockStateInterface.numBlockStateLookups;
|
int numLookupsBefore = BlockStateInterface.numBlockStateLookups;
|
||||||
|
long numCreatedBefore = BetterBlockPos.numCreated;
|
||||||
double actionCost = movementToGetToNeighbor.getCost(calcContext);
|
double actionCost = movementToGetToNeighbor.getCost(calcContext);
|
||||||
long costEnd = System.nanoTime();
|
long costEnd = System.nanoTime();
|
||||||
stateLookup.put(movementToGetToNeighbor.getClass(), BlockStateInterface.numBlockStateLookups - numLookupsBefore + stateLookup.getOrDefault(movementToGetToNeighbor.getClass(), 0));
|
stateLookup.put(movementToGetToNeighbor.getClass(), BlockStateInterface.numBlockStateLookups - numLookupsBefore + stateLookup.getOrDefault(movementToGetToNeighbor.getClass(), 0));
|
||||||
|
posCreation.put(movementToGetToNeighbor.getClass(), BetterBlockPos.numCreated - numCreatedBefore + posCreation.getOrDefault(movementToGetToNeighbor.getClass(), 0L));
|
||||||
timeConsumed.put(movementToGetToNeighbor.getClass(), costEnd - costStart + timeConsumed.getOrDefault(movementToGetToNeighbor.getClass(), 0L));
|
timeConsumed.put(movementToGetToNeighbor.getClass(), costEnd - costStart + timeConsumed.getOrDefault(movementToGetToNeighbor.getClass(), 0L));
|
||||||
count.put(movementToGetToNeighbor.getClass(), 1 + count.getOrDefault(movementToGetToNeighbor.getClass(), 0));
|
count.put(movementToGetToNeighbor.getClass(), 1 + count.getOrDefault(movementToGetToNeighbor.getClass(), 0));
|
||||||
numMovementsConsidered++;
|
numMovementsConsidered++;
|
||||||
@@ -240,6 +243,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
long nanoTime = timeConsumed.get(klass);
|
long nanoTime = timeConsumed.get(klass);
|
||||||
System.out.println(nanoTime / num + " " + klass + " " + nanoTime / 1000000 + "ms " + num);
|
System.out.println(nanoTime / num + " " + klass + " " + nanoTime / 1000000 + "ms " + num);
|
||||||
System.out.println(stateLookup.get(klass) / num + " " + stateLookup.get(klass));
|
System.out.println(stateLookup.get(klass) / num + " " + stateLookup.get(klass));
|
||||||
|
System.out.println(posCreation.get(klass) / num + " " + posCreation.get(klass));
|
||||||
}
|
}
|
||||||
if (cancelRequested) {
|
if (cancelRequested) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
|||||||
@@ -36,6 +36,15 @@ public final class BetterBlockPos extends BlockPos {
|
|||||||
public final int y;
|
public final int y;
|
||||||
public final int z;
|
public final int z;
|
||||||
public final long hashCode;
|
public final long hashCode;
|
||||||
|
public static long numCreated;
|
||||||
|
|
||||||
|
static {
|
||||||
|
numCreated = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
numCreated++;
|
||||||
|
}
|
||||||
|
|
||||||
public BetterBlockPos(int x, int y, int z) {
|
public BetterBlockPos(int x, int y, int z) {
|
||||||
super(x, y, z);
|
super(x, y, z);
|
||||||
|
|||||||
Reference in New Issue
Block a user