VolumeManager: prevent duplicated add_entry call #1307
Closed
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.
As far as I understand we only want to call
add_entry
once per cellID. If we call it more than once nothing happens because we guard against that with them_entries
set. However, currently we call it many additional times, in the worst case twice for every module. Just not doing this seems to reduce the overall initialization time of the VolumeManager by ~20% in our case (CLD).For example when initially called in
populate()
on a generic tracking detector likeDD4hep_SiTrackerBarrel
the following happens:add_entry
is called successfully for the sensitive silicon layer with the cellIDadd_entry
is called for the module with the ID of the silicon layeradd_entry
call does nothing as that cellID is already in them_entries
set.add_entry
call is also performed at every other step up in the recursion (stave, layer, side)...This PR should get rid of these cases, without causing any other behavioural changes.
BEGINRELEASENOTES
exactly as it appears between the two bold lines
ENDRELEASENOTES