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

astar_search does unnecessary initialization of vertices #356

Open
jeremy-murphy opened this issue Dec 3, 2023 · 2 comments
Open

astar_search does unnecessary initialization of vertices #356

jeremy-murphy opened this issue Dec 3, 2023 · 2 comments
Labels
performance Performant use of time and space.

Comments

@jeremy-murphy
Copy link
Contributor

From Keith Bennet:

astar_search() takes too much time to initialize all vertices (in a 2048x2048x40 matrix) even though we only need to initialize vertices when they are added to the open set. We ensure our data's initialization state is identical to a default-constructed object, then guarantee that the vertex initialization is done when the vertex is first added to the open set, and of course A* ensures that vertices aren't used until they're added to the open set (eg, when they're first discovered). To make resizing containers quicker, we ensure that our default-constructed objects are trivially-constructible so that resizing the underlying containers to match the matrix size does not require invoking expensive constructors which effectively reduces the initialization requirements to just resizing the containers correctly and setting the non-zero start-point state and end-point state.

@jeremy-murphy jeremy-murphy added the performance Performant use of time and space. label Dec 3, 2023
@andrea-cassioli-maersk
Copy link
Contributor

Hey, I use Astar quite a lot and I wonder if this is still a thing.

@jeremy-murphy
Copy link
Contributor Author

Needs someone to give it some love.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performant use of time and space.
Projects
None yet
Development

No branches or pull requests

2 participants