mirror of
https://github.com/bensuperpc/astar.git
synced 2024-12-22 00:24:27 +01:00
Improve perf with static lambda function
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
parent
82f9877897
commit
d3247bbc54
@ -196,7 +196,7 @@ Sources and references that I have used to make this library.
|
|||||||
* [a-star](https://www.ce.unipr.it/people/medici/a-star.html)$
|
* [a-star](https://www.ce.unipr.it/people/medici/a-star.html)$
|
||||||
* [A* Search Algorithm](https://yuminlee2.medium.com/a-search-algorithm-42c1a13fcf9f)
|
* [A* Search Algorithm](https://yuminlee2.medium.com/a-search-algorithm-42c1a13fcf9f)
|
||||||
|
|
||||||
## Bench others astar implementations
|
## Others astar implementations
|
||||||
|
|
||||||
The list of others astar implementations that I have benchmarked to compare the performance of my implementation.
|
The list of others astar implementations that I have benchmarked to compare the performance of my implementation.
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ class AStar final : public AStarVirtual<CoordinateType, enableDebug> {
|
|||||||
|
|
||||||
Node<CoordinateType>* currentNode = nullptr;
|
Node<CoordinateType>* currentNode = nullptr;
|
||||||
|
|
||||||
auto compareFn = [](const Node<CoordinateType>* a, const Node<CoordinateType>* b) { return a->getTotalCost() > b->getTotalCost(); };
|
static auto compareFn = [](const Node<CoordinateType>* a, const Node<CoordinateType>* b) { return a->getTotalCost() > b->getTotalCost(); };
|
||||||
std::priority_queue<Node<CoordinateType>*, std::vector<Node<CoordinateType>*>, decltype(compareFn)> openNodeVecPQueue =
|
std::priority_queue<Node<CoordinateType>*, std::vector<Node<CoordinateType>*>, decltype(compareFn)> openNodeVecPQueue =
|
||||||
std::priority_queue<Node<CoordinateType>*, std::vector<Node<CoordinateType>*>, decltype(compareFn)>(compareFn);
|
std::priority_queue<Node<CoordinateType>*, std::vector<Node<CoordinateType>*>, decltype(compareFn)>(compareFn);
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ class AStarFast final : public AStarVirtual<CoordinateType, enableDebug> {
|
|||||||
|
|
||||||
Node<CoordinateType>* currentNode = nullptr;
|
Node<CoordinateType>* currentNode = nullptr;
|
||||||
|
|
||||||
auto compareFn = [](const Node<CoordinateType>* a, const Node<CoordinateType>* b) { return a->getTotalCost() > b->getTotalCost(); };
|
static auto compareFn = [](const Node<CoordinateType>* a, const Node<CoordinateType>* b) { return a->getTotalCost() > b->getTotalCost(); };
|
||||||
std::priority_queue<Node<CoordinateType>*, std::vector<Node<CoordinateType>*>, decltype(compareFn)> openNodeVecPQueue =
|
std::priority_queue<Node<CoordinateType>*, std::vector<Node<CoordinateType>*>, decltype(compareFn)> openNodeVecPQueue =
|
||||||
std::priority_queue<Node<CoordinateType>*, std::vector<Node<CoordinateType>*>, decltype(compareFn)>(compareFn);
|
std::priority_queue<Node<CoordinateType>*, std::vector<Node<CoordinateType>*>, decltype(compareFn)>(compareFn);
|
||||||
std::unordered_map<Vec2i, Node<CoordinateType>*, Vec2i::hash> openNodeMap;
|
std::unordered_map<Vec2i, Node<CoordinateType>*, Vec2i::hash> openNodeMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user