New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
speedup get_source
with lookupdict
#599
Merged
Merged
Conversation
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
JoranAngevaare
changed the title
speedup with lookupdict
speedup Nov 29, 2021
get_source
with lookupdict
ershockley
approved these changes
Dec 8, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works very well, thanks @JoranAngevaare! (and sorry for the delay)
WenzDaniel
approved these changes
Dec 9, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a typo I will commit and merge.
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.
What is the problem / what does the code in this PR do
Speedup #590 with ~40x. We did a lot of checks twice since we went all the way to the lowest dependency for each of the dependencies. This means that e.g. if you have a plugin depending on
records_a
andrecords_b
which both depend onraw_records
you would checkraw_records
twice.Rather than using a set, we can also use a lookup dict to keep track of what we have seen. This speeds up the function by ~40x.
Additional benefits
st.get_source('029000', ('cuts_basic', 'event_info'))
depends_on
as class property)stored_dependencies
Example 1
What sources do we need to start for making
'cuts_basic' and 'event_info'
:This means
'cut_daq_veto', 'event_basics', 'event_pattern_fit', 'event_positions'
are stored and we can compute'cuts_basic'
and'event_info'
for run '029000'.Example 2
or get a list of plugins that are needed and stored:
Meaning we still need to make
'event_info'
and'corrected_areas'
to computecuts_basic
whereas we already havecut_daq_veto
computed.