graph icon indicating copy to clipboard operation
graph copied to clipboard

astar_search does unnecessary initialization of vertices

Open jeremy-murphy opened this issue 2 years ago • 2 comments

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 avatar Dec 03 '23 22:12 jeremy-murphy

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

andrea-cassioli-maersk avatar Dec 10 '24 08:12 andrea-cassioli-maersk

Needs someone to give it some love.

jeremy-murphy avatar Dec 10 '24 23:12 jeremy-murphy