mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-05 06:32:17 -07:00
Fix missing profiler.pop() in PathFinder::findPath (#10320)
This commit is contained in:
@@ -100,8 +100,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- }).min(Comparator.comparingInt(Path::getNodeCount)) : set.stream().map((target) -> {
|
- }).min(Comparator.comparingInt(Path::getNodeCount)) : set.stream().map((target) -> {
|
||||||
- return this.reconstructPath(target.getBestNode(), positions.get(target), false);
|
- return this.reconstructPath(target.getBestNode(), positions.get(target), false);
|
||||||
- }).min(Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount));
|
- }).min(Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount));
|
||||||
- profiler.pop();
|
|
||||||
- return optional.isEmpty() ? null : optional.get();
|
|
||||||
+ // Paper start - Perf: remove streams and optimize collection
|
+ // Paper start - Perf: remove streams and optimize collection
|
||||||
+ Path best = null;
|
+ Path best = null;
|
||||||
+ boolean entryListIsEmpty = entryList.isEmpty();
|
+ boolean entryListIsEmpty = entryList.isEmpty();
|
||||||
@@ -112,6 +110,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ if (best == null || comparator.compare(path, best) < 0)
|
+ if (best == null || comparator.compare(path, best) < 0)
|
||||||
+ best = path;
|
+ best = path;
|
||||||
+ }
|
+ }
|
||||||
|
profiler.pop();
|
||||||
|
- return optional.isEmpty() ? null : optional.get();
|
||||||
+ return best;
|
+ return best;
|
||||||
+ // Paper end - Perf: remove streams and optimize collection
|
+ // Paper end - Perf: remove streams and optimize collection
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user