Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Who can provide a C ++ version of the code? #181

Open
yu2014ol opened this issue Apr 10, 2020 · 5 comments
Open

Who can provide a C ++ version of the code? #181

yu2014ol opened this issue Apr 10, 2020 · 5 comments

Comments

@yu2014ol
Copy link

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.

@brean
Copy link

brean commented Apr 10, 2020

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

@yu2014ol
Copy link
Author

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.

@brean
Copy link

brean commented Apr 11, 2020

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.

@yu2014ol
Copy link
Author

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.

@yu2014ol
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants