Small depresolver efficiency tweaks#588
Open
anderkve wants to merge 2 commits into
Open
Conversation
…se/getCritical. Both DependencyResolver::getPurpose() and getCritical() were doing a linear scan over outputVertices on every call. getCritical() is in the per-scan-point hot path: likelihood_container::more_lnlikes() calls it once per target vertex per scan point. This commit creates a vertex -> OutputVertex* map once at the end of doResolution() (outputVertices is finalised by then and never modified again) and use it for fast loopup lookups in getPurpose() and getCritical()
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two small efficiency tweaks to the depresolver.
Construct a map from vertex ID to outputVertices after running doResolution. This means that functions getPurpose() and getCritical() can use this map for fast lookup.
In the recursive function getParentVertices, use the fact that std::set::insert returns a bool that indicates if the element existed or not to avoid doing first a std::find and then an insert on a std::set.