mirror of
				https://github.com/bensuperpc/astar.git
				synced 2025-10-31 05:46:23 +01:00 
			
		
		
		
	Improve perf with static lambda function
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
		| @@ -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* 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. | ||||
|  | ||||
|   | ||||
| @@ -171,7 +171,7 @@ class AStar final : public AStarVirtual<CoordinateType, enableDebug> { | ||||
|  | ||||
|         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)>(compareFn); | ||||
|  | ||||
| @@ -278,7 +278,7 @@ class AStarFast final : public AStarVirtual<CoordinateType, enableDebug> { | ||||
|  | ||||
|         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)>(compareFn); | ||||
|         std::unordered_map<Vec2i, Node<CoordinateType>*, Vec2i::hash> openNodeMap; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user