-
Notifications
You must be signed in to change notification settings - Fork 282
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 a tree (std::set), which a bigger chunk is coming from mostly caused by copy construction and destruction followed after that. 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. This change doesn't affect any existing tests. PiperOrigin-RevId: 704664031
- Loading branch information
1 parent
2a200be
commit a4ef3ed
Showing
1 changed file
with
103 additions
and
30 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