From a753fe5df9456ce0d73424c1fb7f1d65eb492e09 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 29 Aug 2018 14:46:58 -0700 Subject: [PATCH] bench the whole loop --- .../java/baritone/pathing/calc/AStarPathFinder.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 705a8f74..341b55dc 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -96,8 +96,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { long chunk = 0; int chunkCount = 0; - long chunk2 = 0; - int chunkCount2 = 0; + long goalCheck = 0; + int goalCheckCount = 0; long getNode = 0; int getNodeCount = 0; @@ -110,7 +110,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { } long before = System.nanoTime(); PathNode currentNode = openSet.removeLowest(); - heapRemove += System.nanoTime() - before; + long t = System.nanoTime(); + heapRemove += t - before; heapRemoveCount++; currentNode.isOpen = false; mostRecentConsidered = currentNode; @@ -126,6 +127,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { return Optional.of(new Path(startNode, currentNode, numNodes)); } long constructStart = System.nanoTime(); + goalCheck += constructStart - t; + goalCheckCount++; Movement[] possibleMovements = getConnectedPositions(currentNodePos, calcContext);//movement that we could take that start at currentNodePos, in random order shuffle(possibleMovements); long constructEnd = System.nanoTime(); @@ -220,6 +223,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { System.out.println("Construction " + (construction / constructionCount) + " " + construction / 1000000 + " " + constructionCount); System.out.println("Chunk " + (chunk / chunkCount) + " " + chunk / 1000000 + " " + chunkCount); System.out.println("GetNode " + (getNode / getNodeCount) + " " + getNode / 1000000 + " " + getNodeCount); + System.out.println("GoalCheck " + (goalCheck / goalCheckCount) + " " + goalCheck / 1000000 + " " + goalCheckCount); ArrayList> klasses = new ArrayList<>(count.keySet()); klasses.sort(Comparator.comparingLong(k -> timeConsumed.get(k) / count.get(k))); for (Class klass : klasses) {