aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSuppergerrie2 <[email protected]>2024-03-15 12:09:47 +0100
committerGitHub <[email protected]>2024-03-15 11:09:47 +0000
commitab1afb0ed8838117f00a70fcf507ffedfb00c414 (patch)
tree36c233290dd97620e198a979df973f50e05aad09
parent62b220a87f6991c33423346e5f50e64058e7bdd9 (diff)
downloadPaper-ab1afb0ed8838117f00a70fcf507ffedfb00c414.tar.gz
Paper-ab1afb0ed8838117f00a70fcf507ffedfb00c414.zip
Fix missing profiler.pop() in PathFinder::findPath (#10320)
-rw-r--r--patches/server/1009-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch8
1 files changed, 4 insertions, 4 deletions
diff --git a/patches/server/1009-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/patches/server/1009-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch
index 30e9a24146..f0c0562d70 100644
--- a/patches/server/1009-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch
+++ b/patches/server/1009-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch
@@ -16,7 +16,7 @@ This lets us get faster foreach iteration, as well as avoids map lookups on
the values when needed.
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
-index 8519383a9abd45434c1e9888e77548941a80c79c..eb18494bd7257fa5eb00dea16cf4d5667b796f2b 100644
+index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58dfda6c79 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -38,9 +38,12 @@ public class PathFinder {
@@ -91,7 +91,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..eb18494bd7257fa5eb00dea16cf4d566
if (node2.inOpenSet()) {
this.openSet.changeCost(node2, node2.g + node2.h);
} else {
-@@ -105,23 +113,31 @@ public class PathFinder {
+@@ -105,23 +113,32 @@ public class PathFinder {
}
}
@@ -100,8 +100,6 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..eb18494bd7257fa5eb00dea16cf4d566
- }).min(Comparator.comparingInt(Path::getNodeCount)) : set.stream().map((target) -> {
- return this.reconstructPath(target.getBestNode(), positions.get(target), false);
- }).min(Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount));
-- profiler.pop();
-- return optional.isEmpty() ? null : optional.get();
+ // Paper start - Perf: remove streams and optimize collection
+ Path best = null;
+ boolean entryListIsEmpty = entryList.isEmpty();
@@ -112,6 +110,8 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..eb18494bd7257fa5eb00dea16cf4d566
+ if (best == null || comparator.compare(path, best) < 0)
+ best = path;
+ }
+ profiler.pop();
+- return optional.isEmpty() ? null : optional.get();
+ return best;
+ // Paper end - Perf: remove streams and optimize collection
}