Skip to content

Small depresolver efficiency tweaks#588

Open
anderkve wants to merge 2 commits into
masterfrom
depresolver_efficiency_tweaks
Open

Small depresolver efficiency tweaks#588
anderkve wants to merge 2 commits into
masterfrom
depresolver_efficiency_tweaks

Conversation

@anderkve
Copy link
Copy Markdown
Collaborator

@anderkve anderkve commented May 5, 2026

Two small efficiency tweaks to the depresolver.

  1. 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.

  2. 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.

anderkve added 2 commits May 5, 2026 20:56
…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()
@anderkve anderkve added the Core Core group task label May 5, 2026
@anderkve anderkve requested a review from ChrisJChang May 5, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Core group task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant