crucial performance optimization

This commit is contained in:
Leijurv 2018-08-19 09:39:52 -07:00
parent ff108a55e6
commit d3bd6ae843
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -64,10 +64,9 @@ public class BinaryHeapOpenSet implements IOpenSet {
} }
@Override @Override
public final void update(PathNode node) { public final void update(PathNode val) {
int index = node.heapPosition; int index = val.heapPosition;
int parentInd = index >>> 1; int parentInd = index >>> 1;
PathNode val = array[index];
double cost = val.combinedCost; double cost = val.combinedCost;
PathNode parentNode = array[parentInd]; PathNode parentNode = array[parentInd];
while (index > 1 && parentNode.combinedCost > cost) { while (index > 1 && parentNode.combinedCost > cost) {