PathFinding.js
PathFinding.js copied to clipboard
Who can provide a C ++ version of the code?
My code has encountered performance problems. I tried many times, and it is difficult to achieve the performance of the repository's code, so I think it may need to be rewritten. If you have a mature solution for me, I will be grateful.
Just search for "C++ A*", an implementation of Breadth First Search, Djikstra and A* can be found here: https://www.redblobgames.com/pathfinding/a-star/implementation.html#cplusplus Also take a look at optimizations there: https://www.redblobgames.com/pathfinding/a-star/implementation.html#optimizations
Just search for "C++ A*", an implementation of Breadth First Search, Djikstra and A* can be found here: https://www.redblobgames.com/pathfinding/a-star/implementation.html#cplusplus Also take a look at optimizations there: https://www.redblobgames.com/pathfinding/a-star/implementation.html#optimizations
Wow, thank you. My own code is based on redgames. I have tried some of these optimizations, but it has not worked very well. The author said on the webpage that it is not production code and he didn't run the benchmarks. I found that the operation related to the hash is the most time-consuming through testing. At the same time, I doubt whether it is because the close set is not set. I am still trying to improve, but I am not sure if it needs to be rewritten according to Pathfinding.
The difference of that code to this is that Pathfinding.js stores everything in node objects, so it can execute code on the node without calculating a hash to get the node all the time, maybe that helps you. For further help I think I need your code and your grid-data.
The difference of that code to this is that Pathfinding.js stores everything in node objects, so it can execute code on the node without calculating a hash to get the node all the time, maybe that helps you. For further help I think I need your code and your grid-data.
I thought about this problem before. So now the only way to improve the efficiency of the code is to refactor. This is painful, but may have to be done.
I have a new discovery. When the C ++ version is set to -O3 optimization, the code runs quickly, close to the speed of Pathfinding.js. But I am not sure if it is always so fast.