Wrap the state to navigate the problem space of remove_finished_globals
into a struct
and again into a std::shared_ptr
.
#1852
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Wrap the state to navigate the problem space of
remove_finished_globals
into astruct
and again into astd::shared_ptr
.Profile shows that the majority of the CPU time is spent in construction and destruction of the tree (
GoalSet
-->std::set<..>
), which is mostly caused when doingqueue.pop_front();
. but if we put this data in a shared_ptr instead, we won't delete it immediately, and the heap allocated data will be reused in the case of continue statements, that just puts back the state into the queue without any modification. This change is something that has no downside but has only upsides.Possibly there would be a cleverer fix that would make the internal data more reusable in case of the state-branching within the for loop, but this is an improvement which would be helpful with a quicker fix.