-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert the traverse method of the problem space of the remove_finish…
…ed_goals from BFS into a DFS (stack->queue). Profile shows that the majority of the CPU time is spent in construction and destruction of the tree, which a bigger chunk is coming from mostly caused by copy construction and destruction followed after the construction. The problem space that this function is navigating is big enough that the data structure used cannot be simplified (four sets to track the state of traversal), but if we change the iteration from a BFS into a DFS, we get the benefit to avoid the copy, but rather being able to keep the increment and decrement diff of each iteration and only remember those, which will help avoid copying massive data structures which is super costly. I've tested out whether converting containers into an unordered_set helps, but I only saw some differences that could be considered as a noise, so I'd rather not have those changes. PiperOrigin-RevId: 704664031
- Loading branch information
1 parent
4047709
commit c375f08
Showing
1 changed file
with
120 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters