measure
This commit is contained in:
@@ -102,6 +102,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
|
|
||||||
long getNode = 0;
|
long getNode = 0;
|
||||||
int getNodeCount = 0;
|
int getNodeCount = 0;
|
||||||
|
int startVal = BlockStateInterface.numTimesChunkSucceeded;
|
||||||
|
int startVal2 = BlockStateInterface.numBlockStateLookups;
|
||||||
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && System.nanoTime() / 1000000L - timeoutTime < 0 && !cancelRequested) {
|
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && System.nanoTime() / 1000000L - timeoutTime < 0 && !cancelRequested) {
|
||||||
if (slowPath) {
|
if (slowPath) {
|
||||||
try {
|
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("Remove " + (heapRemove / heapRemoveCount) + " " + heapRemove / 1000000 + " " + heapRemoveCount);
|
||||||
System.out.println("Add " + (heapAdd / heapAddCount) + " " + heapAdd / 1000000 + " " + heapAddCount);
|
System.out.println("Add " + (heapAdd / heapAddCount) + " " + heapAdd / 1000000 + " " + heapAddCount);
|
||||||
System.out.println("Update " + (heapUpdate / heapUpdateCount) + " " + heapUpdate / 1000000 + " " + heapUpdateCount);
|
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 class BlockStateInterface implements Helper {
|
||||||
|
|
||||||
public static int numBlockStateLookups = 0;
|
public static int numBlockStateLookups = 0;
|
||||||
|
public static int numTimesChunkSucceeded = 0;
|
||||||
private static Chunk prev = null;
|
private static Chunk prev = null;
|
||||||
|
|
||||||
public static IBlockState get(BlockPos pos) { // wrappers for chunk caching capability
|
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
|
// we can just skip the mc.world.getChunk lookup
|
||||||
// which is a Long2ObjectOpenHashMap.get
|
// which is a Long2ObjectOpenHashMap.get
|
||||||
if (cached != null && cached.x == pos.getX() >> 4 && cached.z == pos.getZ() >> 4) {
|
if (cached != null && cached.x == pos.getX() >> 4 && cached.z == pos.getZ() >> 4) {
|
||||||
|
numTimesChunkSucceeded++;
|
||||||
return cached.getBlockState(pos);
|
return cached.getBlockState(pos);
|
||||||
}
|
}
|
||||||
Chunk chunk = mc.world.getChunk(pos);
|
Chunk chunk = mc.world.getChunk(pos);
|
||||||
|
|||||||
Reference in New Issue
Block a user