also bench getnode
This commit is contained in:
@@ -97,6 +97,9 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
|
|
||||||
long chunk2=0;
|
long chunk2=0;
|
||||||
int chunkCount2=0;
|
int chunkCount2=0;
|
||||||
|
|
||||||
|
long getNode=0;
|
||||||
|
int getNodeCount=0;
|
||||||
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && System.currentTimeMillis() < timeoutTime && !cancelRequested) {
|
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && System.currentTimeMillis() < timeoutTime && !cancelRequested) {
|
||||||
if (slowPath) {
|
if (slowPath) {
|
||||||
try {
|
try {
|
||||||
@@ -142,13 +145,15 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
long k=System.nanoTime();
|
long k=System.nanoTime();
|
||||||
chunk2+=k-s;
|
chunk2+=k-s;
|
||||||
chunkCount2++;
|
chunkCount2++;
|
||||||
if (!isPositionCached && Minecraft.getMinecraft().world.getChunk(dest) instanceof EmptyChunk) {
|
boolean currentlyLoaded=Minecraft.getMinecraft().world.getChunk(dest) instanceof EmptyChunk;
|
||||||
numEmptyChunk++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
long costStart = System.nanoTime();
|
long costStart = System.nanoTime();
|
||||||
chunk+=costStart-k;
|
chunk+=costStart-k;
|
||||||
chunkCount++;
|
chunkCount++;
|
||||||
|
if (!isPositionCached && currentlyLoaded) {
|
||||||
|
numEmptyChunk++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO cache cost
|
// TODO cache cost
|
||||||
double actionCost = movementToGetToNeighbor.getCost(calcContext);
|
double actionCost = movementToGetToNeighbor.getCost(calcContext);
|
||||||
long costEnd = System.nanoTime();
|
long costEnd = System.nanoTime();
|
||||||
@@ -166,7 +171,10 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
// see issue #18
|
// see issue #18
|
||||||
actionCost *= favorCoeff;
|
actionCost *= favorCoeff;
|
||||||
}
|
}
|
||||||
|
long st=System.nanoTime();
|
||||||
PathNode neighbor = getNodeAtPosition(dest);
|
PathNode neighbor = getNodeAtPosition(dest);
|
||||||
|
getNode+=System.nanoTime()-st;
|
||||||
|
getNodeCount++;
|
||||||
double tentativeCost = currentNode.cost + actionCost;
|
double tentativeCost = currentNode.cost + actionCost;
|
||||||
if (tentativeCost < neighbor.cost) {
|
if (tentativeCost < neighbor.cost) {
|
||||||
if (tentativeCost < 0) {
|
if (tentativeCost < 0) {
|
||||||
@@ -212,6 +220,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
System.out.println("Construction "+(construction/constructionCount)+" "+construction/1000000+" "+constructionCount);
|
System.out.println("Construction "+(construction/constructionCount)+" "+construction/1000000+" "+constructionCount);
|
||||||
System.out.println("EmptyChunk "+(chunk/chunkCount)+" "+chunk/1000000+" "+chunkCount);
|
System.out.println("EmptyChunk "+(chunk/chunkCount)+" "+chunk/1000000+" "+chunkCount);
|
||||||
System.out.println("CachedChunk "+(chunk2/chunkCount2)+" "+chunk2/1000000+" "+chunkCount2);
|
System.out.println("CachedChunk "+(chunk2/chunkCount2)+" "+chunk2/1000000+" "+chunkCount2);
|
||||||
|
System.out.println("GetNode "+(getNode/getNodeCount)+" "+getNode/1000000+" "+getNodeCount);
|
||||||
ArrayList<Class<? extends Movement>> klasses = new ArrayList<>(count.keySet());
|
ArrayList<Class<? extends Movement>> klasses = new ArrayList<>(count.keySet());
|
||||||
klasses.sort(Comparator.comparingLong(k -> timeConsumed.get(k) / count.get(k)));
|
klasses.sort(Comparator.comparingLong(k -> timeConsumed.get(k) / count.get(k)));
|
||||||
for (Class<? extends Movement> klass : klasses) {
|
for (Class<? extends Movement> klass : klasses) {
|
||||||
|
|||||||
Reference in New Issue
Block a user