forked from RepoMirrors/baritone
measure
This commit is contained in:
parent
1fe262929e
commit
da07b63e0a
|
@ -102,6 +102,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||
|
||||
long getNode = 0;
|
||||
int getNodeCount = 0;
|
||||
int startVal = BlockStateInterface.numTimesChunkSucceeded;
|
||||
int startVal2 = BlockStateInterface.numBlockStateLookups;
|
||||
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && System.nanoTime() / 1000000L - timeoutTime < 0 && !cancelRequested) {
|
||||
if (slowPath) {
|
||||
try {
|
||||
|
@ -220,6 +222,9 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||
}
|
||||
}
|
||||
}
|
||||
int numBlockState = BlockStateInterface.numBlockStateLookups - startVal2;
|
||||
int numSucc = BlockStateInterface.numTimesChunkSucceeded - startVal;
|
||||
System.out.println("Out of " + numBlockState + " block state lookups, " + numSucc + " were in the same chunk as the previous and could be cached");
|
||||
System.out.println("Remove " + (heapRemove / heapRemoveCount) + " " + heapRemove / 1000000 + " " + heapRemoveCount);
|
||||
System.out.println("Add " + (heapAdd / heapAddCount) + " " + heapAdd / 1000000 + " " + heapAddCount);
|
||||
System.out.println("Update " + (heapUpdate / heapUpdateCount) + " " + heapUpdate / 1000000 + " " + heapUpdateCount);
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.world.chunk.Chunk;
|
|||
public class BlockStateInterface implements Helper {
|
||||
|
||||
public static int numBlockStateLookups = 0;
|
||||
public static int numTimesChunkSucceeded = 0;
|
||||
private static Chunk prev = null;
|
||||
|
||||
public static IBlockState get(BlockPos pos) { // wrappers for chunk caching capability
|
||||
|
@ -47,6 +48,7 @@ public class BlockStateInterface implements Helper {
|
|||
// we can just skip the mc.world.getChunk lookup
|
||||
// which is a Long2ObjectOpenHashMap.get
|
||||
if (cached != null && cached.x == pos.getX() >> 4 && cached.z == pos.getZ() >> 4) {
|
||||
numTimesChunkSucceeded++;
|
||||
return cached.getBlockState(pos);
|
||||
}
|
||||
Chunk chunk = mc.world.getChunk(pos);
|
||||
|
|
Loading…
Reference in New Issue